Skip to main content

Overview

The Cancel One-Time Payment endpoint allows you to cancel an active payment link before it is used or expires. Once cancelled, the payment link cannot be completed by customers and cannot be reactivated. Common use cases:
  • Customer requests to cancel an order
  • Duplicate payment links were created by mistake
  • Order or service was cancelled before payment
  • Payment details need to be corrected (cancel and create new link)
Cancellation is permanent and irreversible. Once a payment link is cancelled, it cannot be reactivated. If you need to accept payment again, you must create a new payment link.

Authentication

This endpoint requires API key authentication using the x-api-key header.
Your API key can be found in your organization settings. Keep it secure and never expose it in client-side code.

Cancellation Rules

You can only cancel a payment link if all of these conditions are met:
1

Payment status is PENDING

The payment must be in PENDING status. You cannot cancel payments that are already CONFIRMED or CANCELLED.
2

Payment has not expired

The payment link must not have passed its expiration date (expiresAt). Expired payments cannot be cancelled.
3

Payment belongs to your organization

You can only cancel payment links that belong to your organization.

Request Format

string
required
The unique identifier (UUID) of the one-time payment to cancel.

Response Format

The endpoint returns the cancelled payment object with status: "CANCELLED":
Notice the updatedAt timestamp reflects when the cancellation occurred.

Examples

Cancel with error handling

Check status before cancelling

Error Responses

error
Cannot cancel payment - The payment is not in PENDING status or has already expired.Common reasons:
  • Payment status is CONFIRMED (already paid)
  • Payment status is CANCELLED (already cancelled)
  • Payment has passed its expiresAt date
error
Payment not found - No payment with the specified ID exists in your organization.
error
Unauthorized - Missing or invalid API key.

Best Practices

Check status first - Before cancelling, fetch the payment details to verify it can be cancelled. This prevents unnecessary API calls and provides better error messages.
Log cancellations - Keep audit logs of cancelled payments including the reason and who initiated the cancellation.
Notify customers - If a customer initiated a payment link that you’re cancelling, notify them via email that the payment link is no longer valid.
Handle race conditions - If a customer completes a payment at the same time you cancel it, the cancellation will fail with a 400 error. The payment platform uses database locks to prevent race conditions.

Common Use Cases

Order Cancellation Workflow

Bulk Cancellation

Duplicate Detection and Cancellation

Integration Tips

Webhook Integration - If you use webhooks for payment notifications, ensure your system can handle cancellation events to keep your order status in sync.
Idempotency - Attempting to cancel an already cancelled payment will return a 400 error. Check the error message to determine if the payment was previously cancelled.
External ID Tracking - Use the externalId field to easily find and cancel payment links associated with specific orders or transactions in your system.

What Happens After Cancellation

After a payment link is successfully cancelled:
  1. Status Change - The payment status changes from PENDING to CANCELLED
  2. Customer Access - Customers can no longer access or complete the payment using the payment link URL
  3. Irreversible - The cancellation cannot be undone
  4. New Payment Required - If payment is still needed, you must create a new payment link
Cancelled payments remain in your system for record-keeping and can be retrieved via the List or Get endpoints.

Next Steps

Create Payment

Create a new payment link to replace the cancelled one

List Payments

View all payment links including cancelled ones