Overview
If a payment request no longer needs to be collected, you can cancel it through the/Payment/{paymentRequestId}/Cancel endpoint. Canceling a request stops the payer from completing that payment and moves the payment request to the Canceled status.
Use this endpoint for payment requests that are still outstanding, such as requests that are pending payer action, scheduled for a future date, or otherwise not yet completed.
How It Works
Obtain an Access Token
Before calling the cancel endpoint, secure an access token by making a
POST request to /auth/token using your ClientId and ClientSecret.Identify the Payment Request
Use the
PaymentRequestId returned when the payment request was created, or the ID received in a payment status webhook.Submit the Cancellation
Send a
POST request to /Payment/{paymentRequestId}/Cancel with the payment request ID in the path.Canceling the Payment Request
The/Payment/{paymentRequestId}/Cancel endpoint cancels an existing payment request by referencing its PaymentRequestId.
Endpoint
- URL:
https://api.synchpay.com/Payment/{paymentRequestId}/Cancel - Method:
POST - Authorization:
Bearer <AccessToken>
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
paymentRequestId | string | Unique identifier of the payment request to cancel | Yes |
Request Body
This endpoint does not require a request body.Example Request
Response
A successful request returns200 OK with no response body.
Error Responses
| Status code | Cause |
|---|---|
400 | The payment request cannot be canceled from its current status. |
401 | Missing or invalid access token. |
404 | The payment request was not found. |
When to Use This Endpoint
Use the cancel endpoint when you want to:- Stop an unpaid payment request before the payer completes it.
- Cancel a scheduled payment request before it is processed.
- Prevent a duplicate or incorrect request from being paid.
Payment Status
After a successful cancellation, the payment request moves toCanceled, which is a final state. See payment statuses for the full status transition table.