Pesquisar

Are you looking for test card numbers?

Would you like to contact support?

Atenção, esta página não se encontra disponível em Português
Default icon

Cancel

Cancel the authorisation on a payment that has not yet been captured.

Cancel in Customer Area

You can also cancel payments in your Customer Area. For more information, refer to Manage payments.

For some payment methods, the payment is completed in two steps:

  1. Authorisation – The payment details of the shopper are verified, and the funds are reserved.
  2. Capture –  The reserved funds are transferred from the shopper to your account. 

If you have authorised a payment but do not want to capture it, for example because an item is out of stock, you need to cancel the payment. To specify the payment that you want to cancel, use the pspReference of this payment.

If you don't have the pspReference available, for example because of a timeout error, you can also cancel without the pspReference.

If you want to cancel a payment but are not sure whether it has been captured, use the /payments/{paymentPspReference}/reversals endpoint instead.

Cancel a payment

To cancel a payment, make a POST /payments/{paymentPspReference}/cancels request, where paymentPspReference is the pspReference of the payment that you want to cancel. You can find the pspReference in the AUTHORISATION webhook.

In your request, include:

  • merchantAccount: The name of your merchant account that is used to process the payment.
  • reference: Optionally, you can specify a reference for this cancel request.
curl https://checkout-test.adyen.com/checkout/v67/payments/8836183819713023/cancels \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
    "reference": "Cancel123",
    "merchantAccount": "YOUR_MERCHANT_ACCOUNT"
}'

The /payments/{paymentPspReference}/cancels response includes a pspReference, Adyen's unique reference associated with this cancel request.

{
    "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
    "paymentPspReference": "8836183819713023",
    "pspReference" : "8412534564722331",
    "reference": "Cancel123",
    "status" : "received"
}

CANCELLATION webhook

You get the outcome of the cancel request asynchronously, in a CANCELLATION webhook that includes:

  • eventCodeCANCELLATION.
  • originalReference: The paymentPspReference.
  • pspReference: The pspReference from the /payments/{paymentPspReference}/cancels response.
  • success: Indicates whether the cancel request was successful. Possible values:

    • true: The cancel request was successful.
    • false:  The cancel request failed. The notification includes a reason field with a short description of the problem. Review the reason, fix the issue if possible, and resubmit the cancel request.
{
   "live":"false",
   "notificationItems":[
      {
         "NotificationRequestItem":{
            "amount":{
               "currency":"EUR",
               "value":500
            },
            "eventCode":"CANCELLATION",
            "eventDate":"2021-03-05T09:08:05+01:00",
            "merchantAccountCode":"YOUR_MERCHANT_ACCOUNT",
            "originalReference":"8836183819713023",
            "paymentMethod":"mc",
            "pspReference":"8412534564722331",
            "reason":"",
            "success":"true"
         }
      }
   ]
}
{
   "live":"false",
   "notificationItems":[
      {
         "NotificationRequestItem":{
            "amount":{
               "currency":"EUR",
               "value":500
            },
            "eventCode":"CANCELLATION",
            "eventDate":"2021-03-05T09:08:05+01:00",
            "merchantAccountCode":"YOUR_MERCHANT_ACCOUNT",
            "originalReference":"8836183819713023",
            "paymentMethod":"mc",
            "pspReference":"8412534564722331",
            "reason":"Transaction not found",
            "success":"false"
         }
      }
   ]
}

For more information about the included fields, see CANCELLATION notification reference.

Cancel without the pspReference

The /cancels endpoint allows you to cancel a payment using the reference from your /payments request. Cancelling a payment using the reference is only possible for 24 hours after authorisation.

We recommend that you only cancel using the reference if you are generating unique references for payment requests, and don't have the pspReference available.

To cancel a payment using your reference, make a POST /cancels request, and specify:

  • paymentReference: The reference of the payment that you want to cancel.
  • merchantAccount: The name of your merchant account that is used to process the payment.
  • reference: Optionally, you can specify your own reference for this cancel request.
curl https://checkout-test.adyen.com/checkout/v67/cancels \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
    "paymentReference": "Payment123",
    "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
    "reference": "YourCancelReference",
}'

The /cancels response includes a pspReference, Adyen's unique reference associated with this cancel request.

{
    "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
    "paymentReference": "Payment123",
    "pspReference" : "8412534564722331",
    "reference": "YourCancelReference",
    "status" : "received"
}

TECHNICAL_CANCEL webhook

If you cancel a payment using the reference instead of the pspReference, you get the outcome of the request in a TECHNICAL_CANCEL webhook. The webhook contains:

  • eventCodeTECHNICAL_CANCEL
  • pspReference: The pspReferencefrom the /cancels response. 
  • originalReference: The pspReference of the payment that you requested to cancel.
  • success: Indicates whether the cancel request was successful. 
{
   "live":"false",
   "notificationItems":[
      {
         "NotificationRequestItem":{
            "additionalData":{
               "paymentMethodVariant":"visa"
            },
            "amount":{
               "currency":"EUR",
               "value":5000
            },
            "eventCode":"TECHNICAL_CANCEL",
            "eventDate":"2021-07-18T22:35:14+02:00",
            "merchantAccountCode":"YOUR_MERCHANT_ACCOUNT",
            "merchantReference":"Payment123",
            "originalReference":"8313547924770610",
            "paymentMethod":"visa",
            "pspReference":"8412534564722331",
            "reason":"",
            "success":"true"
         }
      }
   ]
}

For more information about the included fields, see the TECHNICAL_CANCEL notification reference.

See also