Cancel a payment
In this tutorial, you'll learn how to:
✅ Cancel an XPay transfer
If you are new to XPay we recommend you read the XPay overview before starting this tutorial
The tutorial assumes you have a knowledge of APIs and how they work. Refer to the API overview for more details
The tutorial uses these API endpoints
API | Description |
Cancel an outgoing push payment |
The tutorial uses these webhooks
Webhook | Description |
XPay.Payment.Canceled | Payment canceled at the sender's request or has expired |
Make sure you have:
- Partner ID
- XPay enabled on both partner accounts
To receive the webhook events for this tutorial both partner accounts need to register each specific webhook event type. Once you are registered, the event objects are sent to the registered URLs.
The event object contains a list of resource identifiers used to download details on each event.
In order to have a payment to cancel, you need to originate a push payment. Learn how to originate a payment in the Originate a payment tutorial.
Call POST /XPay/v1/payments/{id}/cancel. For this call, the id attribute is required.
The id attribute is the relatedPaymentID found in response body of the push request.
The XPay.Payment.Canceled webhook is triggered and the payment is canceled.