alt

Important information

The API reference is now available here.
The deprecated API reference is available here.

Unzer

Cancel an authorization

Learn what reversal are and how to implement them using Unzer API.

Overview

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.

icon info
Total amount
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"
}
ParameterTypeDescription
codeOrOrderId
(required)
stringPath Parameter — The related payment identity. This can be the paymentCode or ID.
amountfloatAmount 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 parameterDescription
isSuccessThe cancellation call was executed successfully.
isPendingNever happens.
isErrorSomething 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.

ParameterTypeDescription
idstringID of this cancellation transaction
isSuccessbooleanIf the transaction was successful, the value is set to true.
isPendingbooleanIs not applicable for a cancel transaction.
isErrorbooleanIf an error occurs, this value is set to true.
messageobject
message.codestringA 9 digit code returned with every API call.
message.customerstringResponse message for your customer translated into the customer language.
message.merchantstringResponse message for you. This message appears always in English.
amountstringThe amount to be reversed (released) on the specified account. The amount is in decimal form for example, EUR 1.22.
currencystring(3)ISO currency code.
returnUrlstringAlways empty. Cancel transaction doesn’t require redirection or confirmation
paymentReferencestringThe description of the transaction.
datedateTimestamp of this transaction.
resourcesobject
resources.customerIdstringCustomer ID used for this transaction.
resource.basketIdstringBasket ID used for this transaction.
resource.metadataIdstringMetadata ID used for this transaction.
resources.paymentIdstringID of the payment object.
resources.traceIdstringThe unique traceId of the transaction. Used for internal API purposes.
resources.typeIdstringID of the types resource which was used for this transaction.
processingobject
processing.uniqueIdstringReference id of the cancellation transaction.
processing.shortIdstringUser-friendly reference ID of the cancellation transaction.
processing.ibanstringYour (merchant) IBAN in case of prepayment or invoice. In case of direct debit this value contains the customer IBAN.
processing.bicstringYour (merchant) BIC for prepayment or invoice. In the case of a direct debit, this value contains the customer BIC.
processing.identificationstringThis value returns the descriptor for invoice and prepayment.
processing.creatorIdstringThis value returns your creditor ID.

For a full description of the cancel call, see the API reference guide.

See also