How to cancel an XPay payment
In this tutorial, you'll learn how to
Register the relevant webhooks
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 |
---|---|
|
Payment canceled at the sender's request or has expired |
Before you begin
Make sure you have:
-
Partner ID
-
XPay enabled on both partner accounts
1. Register the relevant webhook events
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.
2. Originate an XPay push transaction
In order to have a payment to cancel, you need to originate a push payment. Learn how to originate a payment in the How to originate an XPay payment tutorial.
3. Cancel the XPay payment
a. To cancel the push payment
-
Call
POST /XPay/v1/payments/{id}/cancel
. For this call, theid
attribute is required.The
id
attribute is therelatedPaymentID
found in response body of the push request. -
The
XPay.Payment.Canceled
webhook is triggered and the payment is canceled.