Merchant API

Cancel a pending payment

POST /payment_intents/:id/cancel-pending while the payment is still pending.

Request cancellation of a pending payment. The cancellation runs durably inside the payment operation; poll the intent or wait for webhooks until status is terminal.

Cancel-pending is only valid while status is pending and the frozen route supports the operation. Unsupported routes return 422 provider_capability_unsupported.

Endpoint

POST /payment_intents/:id/cancel-pending

Required headers:

  • Authorization: Basic <base64(publicKey:secretKey)>.
  • Content-Type: application/json.

Optional but recommended:

  • Idempotency-Key: <uuid>.

Request

No body is required.

curl -s -X POST "$API_BASE/payment_intents/dord_01HZX.../cancel-pending" \
  -u "$API_PUBLIC_KEY:$API_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json"

Success

The endpoint returns 202 Accepted with the current payment intent representation. Cancellation may still be in flight; status can remain pending until the operation observes payment.cancelled (or another terminal outcome).

Poll GET /payment_intents/:id or handle webhooks until status is no longer pending.

Errors

HTTPCodeMeaning
404not_foundUnknown id, or not owned by this merchant in this environment.
422provider_capability_unsupportedThe configured route does not support cancel-pending.
422invalid_stateThe payment is no longer pending.

See Errors for the full closed union.

On this page