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:
- Authorization – The payment details of the shopper are verified, and the funds are reserved.
- Capture – The reserved funds are transferred from the shopper to your account.
If you have authorized 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 do not have the pspReference
available, for example because of a timeout error, you can also cancel without the pspReference
.
Cancel a payment
To cancel a payment that has been authorized but not captured yet:
-
From the AUTHORISATION webhook, get the
pspReference
of the authorization you want to cancel. -
Make a POST request to the /payments/{paymentPspReference}/cancels endpoint, where
paymentPspReference
is the PSP reference of the authorization you want to cancel.If you are not sure whether the authorization has been captured, use the
/payments/{paymentPspReference}/reversals
endpoint instead.In your request, include:
Parameter Required Description merchantAccount
The name of your merchant account that is used to process the payment. reference
Your reference for the cancel request. The following example shows how to cancel an authorization that has the
pspReference
XB7XNCQ8HXSKGK82. -
When you receive the /payments/{paymentPspReference}/cancels response, note:
paymentPspReference
: the PSP reference of the authorization you want to cancel.pspReference
: Adyen's unique reference associated with this cancel request.
{ "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "paymentPspReference": "XB7XNCQ8HXSKGK82", "pspReference" : "JDD6LKT8MBLZNN84", "reference": "YOUR_UNIQUE_REFERENCE", "status" : "received" }
-
Wait for the CANCELLATION webhook to learn the outcome of the cancel request.
CANCELLATION webhook
You receive the outcome of the cancel request asynchronously, in a webhook that includes :
eventCode
: CANCELLATION.originalReference
: the PSP reference of the authorization.pspReference
: same as thepspReference
in 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 webhook event includes a
reason
field with a short description of the problem. Review the reason, fix the issue if possible, and resubmit the cancel request.
For more information about the included fields, see the CANCELLATION webhook reference.
Cancel without the pspReference
The /cancels endpoint allows you to cancel a payment using the reference from your /payments request. Canceling a payment using the reference
is only possible for 24 hours after authorization.
We recommend that you only cancel using the reference
if you are generating unique references for payment requests, and do not 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.
The /cancels response includes a pspReference
, Adyen's unique reference associated with this cancel request.
{
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"paymentReference": "Payment123",
"pspReference" : "XB7XNCQ8HXSKGK82",
"reference": "YOUR_UNIQUE_REFERENCE",
"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:
eventCode
: TECHNICAL_CANCELpspReference
: ThepspReference
from the /cancels response.originalReference
: ThepspReference
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":"XB7XNCQ8HXSKGK82",
"paymentMethod":"visa",
"pspReference":"JDD6LKT8MBLZNN84",
"reason":"",
"success":"true"
}
}
]
}
For more information about the included fields, see the TECHNICAL_CANCEL webhook reference.