Cancel a payment
Find out how to cancel a payment that hasn't yet been authorized.
Cancel payments when you don’t want to proceed, for example because authorization has been declined by the card issuer. You can only cancel a payment before it has been authorized. Payments that have not yet been authorized must be reversed, instead.
Cancel using the Dojo API
To cancel a payment to your customer, use the endpoint below:
DELETE /payment-intents/{paymentIntentId}
In your request, include:
paymentIntentId
: identifies the payment being canceled.
For the full specification, see the API reference.
Request example
The next example shows how to cancel a payment intent.
- cURL
- PowerShell
- Python
- C#
- PHP
manage-payments/curl/cancel.sh
loading...
manage-payments/powershell/cancel.ps1
loading...
manage-payments/python/cancel.py
loading...
manage-payments/cs/cancel.cs
loading...
manage-payments/php/cancel.php
loading...
Response example
If your request is successful, the response will return information about the canceled payment, and the status will be Canceled
.
{
"id": "pi_sandbox_RBMHTJ4fIkmSppDILZVCGw",
"captureMode": "Auto",
"status": "Canceled",
"paymentMethods": [
"Card"
],
"amount": {
"value": 1000,
"currencyCode": "GBP"
},
"totalAmount": {
"value": 1000,
"currencyCode": "GBP"
},
"createdAt": "2022-02-21T14:39:21.6050276Z",
"updatedAt": "2022-02-21T14:39:21.6050277Z"
}