Skip to main content

Cancel payment

POST 

/payments/:payment_id/cancel

Only PENDING payments can be cancelled. PROCESSING payments are owned by the external PG, so a unilateral cancel would race with the PG's PAID confirmation and is rejected with 409 INVALID_PAYMENT_STATE. PAID / EXPIRED / CANCELLED / *_REFUNDED likewise return 409. If the buyer abandons during PROCESSING, the expiry worker finalizes it as EXPIRED on TTL expiry, or the PG webhook closes it as FAILED.

The Idempotency-Key header is optional; retries with the same key replay the first response verbatim (24h TTL, Redis-cached).

Request

Responses

Payment cancelled successfully