Cancel an authorization
Learn what reversal are and how to implement them using Unzer API.
OverviewOverview
Canceling an authorization releases the reserved money for the customer’s payment method. This is also called reversal. You can only perform the cancel
transaction on an existing authorization. This transaction is possible for selected payment methods only. Please check Payment methods page for details.
If you cancel an authorization, the total amount of the payment is reduced by the amount reversed.
Example
Reversal is triggered by calling payments/{codeororderid}/authorize/cancels
endpoint. You can cancel the authorization with an amount. In this case, only the specified authorization amount is released. If you do not specify an amount, the entire authorization is canceled.
{
"amount" : "50.00"
}
Parameter | Type | Description |
---|---|---|
codeOrOrderId (required) | string | Path Parameter — The related payment identity. This can be the paymentCode or ID. |
amount | float | Amount in decimal values (for example, EUR 12.20) |
{
"id": "s-cnl-1",
"isSuccess": true,
"isPending": false,
"isError": false,
"message": {
"code": "COR.000.100.112",
"merchant": "Request successfully processed in 'Merchant in Connector Test Mode'",
"customer": "Your payments have been successfully processed in sandbox mode."
},
"amount": "50.0000",
"currency": "EUR",
"date": "2018-09-24 22:06:41",
"resources": {
"customerId": "s-cst-e769ddae5686",
"paymentId": "s-pay-6986",
"basketId": "",
"metadataId": "",
"traceId": "bf4ce634575d479eaaac4e6ad436d95d",
"typeId": "s-crd-qfisvuhm3jog"
},
"processing": {
"uniqueId": "31HA07BC81AB33BC5F44A2659D5E80FC",
"shortId": "4017.5320.1722"
}
}
As shown in the example, the cancel ID is returned with the value s-cnl-1
. The parameters isSuccess
, isPending
, isError
indicate the result of the transaction. Only one of these three can be true.
Status parameter | Description |
---|---|
isSuccess | The cancellation call was executed successfully. |
isPending | Never happens. |
isError | Something went wrong. message.merchant contains more information about the problem. |
If there is an error, an error code is displayed in the details with a message for you and the customer.
Parameter | Type | Description |
---|---|---|
id | string | ID of this cancellation transaction |
isSuccess | boolean | If the transaction was successful, the value is set to true . |
isPending | boolean | Is not applicable for a cancel transaction. |
isError | boolean | If an error occurs, this value is set to true . |
message | object | |
message.code | string | A 9 digit code returned with every API call. |
message.customer | string | Response message for your customer translated into the customer language. |
message.merchant | string | Response message for you. This message appears always in English. |
amount | string | The amount to be reversed (released) on the specified account. The amount is in decimal form for example, EUR 1.22. |
currency | string(3) | ISO currency code. |
returnUrl | string | Always empty. Cancel transaction doesn’t require redirection or confirmation |
paymentReference | string | The description of the transaction. |
date | date | Timestamp of this transaction. |
resources | object | |
resources.customerId | string | Customer ID used for this transaction. |
resource.basketId | string | Basket ID used for this transaction. |
resource.metadataId | string | Metadata ID used for this transaction. |
resources.paymentId | string | ID of the payment object. |
resources.traceId | string | The unique traceId of the transaction. Used for internal API purposes. |
resources.typeId | string | ID of the types resource which was used for this transaction. |
processing | object | |
processing.uniqueId | string | Reference id of the cancellation transaction. |
processing.shortId | string | User-friendly reference ID of the cancellation transaction. |
processing.iban | string | Your (merchant) IBAN in case of prepayment or invoice. In case of direct debit this value contains the customer IBAN. |
processing.bic | string | Your (merchant) BIC for prepayment or invoice. In the case of a direct debit, this value contains the customer BIC. |
processing.identification | string | This value returns the descriptor for invoice and prepayment. |
processing.creatorId | string | This value returns your creditor ID. |
For a full description of the cancel
call, see the API reference guide.