# Reverse a settled payment

This operation reverses (totally or partially) a settlement operation. From an account perspective it consists in debiting the merchant and subsequently crediting back the amount originally due to the buyer’s credit card.

Obviously, it may be performed only on already-settled transactions.

An already-settled transaction may also be reversed more than once, for partial amounts, until a total equal to the settled amount is reached.

The correct WSs2s web service method to be used for this purpose is CallRefundS2S.

However, before using this method, it is necessary to assign to WSs2s all of the information required to securely identify the transaction to be reversed.

A transaction may be uniquely identified by the pair shopLogin + bankTransactionID.

It is however possible to use also the code assigned by the merchant to the transaction, taking care first to ascertain that the code uniquely identifies a transaction; otherwise, CallRefundS2S will return an error code referring to a Non-uniquely identified transaction.

As a transaction may be reversed also for an amount which is less than the amount for which the transaction was settled, it is necessary also to assign to CallRefundS2S the amount to be withdrawn and the currency code in which the amount is expressed.

the currency must be the same as the settled amount.

In order to do all this it is sufficient to set the specific fields:

• shopLogin (merchant code)
• bankTransactionID (GestPay transaction code) or
• shopTransactionID (merchant transaction ID code)
• uicCode (currency code)
• amount (amount)

Unlike the authorisation request operation, the reversal operation cannot incur a negative result, unless this is due to technical reasons. In order to know the outcome of the operation, it is therefore sufficient to consult its technical result, by reading in the XML return file the following values:

• ErrorCode (and ErrorDescription)