Logo
GoCardless API API Documentation

Cancel a Payment

POST {{url}}/payments/{{payment}}/actions/cancel

Cancels the payment if it has not already been submitted to the banks. Any metadata supplied to this endpoint will be stored on the payment cancellation event it causes.

This will fail with a cancellationfailed error unless the payment’s status is pendingsubmission.

Cancel a payment API Docs

 

Body PARAM

Key Datatype Required Description 



HEADERS

Key Datatype Required Description 




RESPONSES

status OK

{ "payments": { "id": "PM009N4V35FCTR", "created_at": "2024-03-22T20:31:28.319Z", "charge_date": "2024-04-02", "amount": 96140, "description": null, "currency": "GBP", "status": "cancelled", "amount_refunded": 0, "reference": null, "metadata": { "key": "value" }, "fx": { "fx_currency": null, "fx_amount": null, "exchange_rate": null, "estimated_exchange_rate": null }, "links": { "mandate": "MD000ZS5B9F5D5", "creditor": "CR00006C6DF0TD" }, "retry_if_possible": true } }



Curl
curl -X POST 'https://api-sandbox.gocardless.com/payments/https://api-sandbox.gocardless.com/actions/cancel' -d '{"payments":{"metadata":{"key":"value"}}}'

ENDPOINTS