422
payments.cancel_not_allowedpaymentsRule R16Only an open payment can be canceled
Cancel works while the payment is created, requires_action or failed. A processing payment cannot be canceled — money may already be moving — and a succeeded, expired or already-canceled one has nothing to cancel.
Why the API refuses
WHEN CancelPayment is executed, THE SYSTEM SHALL reject it unless the payment status is created, requires_action or failed; IF the current attempt holds a cancelable instrument THEN THE SYSTEM SHALL void it at the provider before transitioning to canceled.
What to do
- Read the payment and branch on
status. Forprocessing, wait for the terminal state (or its webhook) and refund if it succeeds and you no longer want it. - For
succeeded, usePOST /payments/{id}/refundsinstead. - An
expiredpayment needs no cancelation; treat expiry as the cancelation.