TL;DR: Cancel only works on a
pending session — check the status first if you get a 409.pending. Calling cancel on a session in any other state returns a conflict, rather than silently doing nothing or charging/refunding on your behalf.
When this happens
- You call cancel while the shopper is mid-payment (session
processing), or after it already reachedcompleted,failed,expired, orcancelled. - You call cancel on a
checkout_idthat doesn’t exist for your account.
What you see
Calling cancel twice on an already-cancelled session is safe — it’s treated as idempotent, not an error. Only a session in
processing or a terminal state (completed, failed, expired) other than cancelled returns the 409.What to do
1
Check the session's current status first
Before retrying a cancel that returned
409, find out what actually happened (API reference):2
Branch on the status
processing: wait and re-check shortly — the shopper is actively completing payment, and cancelling mid-attempt isn’t supported.completed: the payment already succeeded. Don’t retry the cancel — if you need to reverse it, refund the transaction through the Payments API instead.failed/expired: the session is already terminal and never charged anything — no action needed.cancelled: already done — treat the original conflicting call as resolved.
3
Retry the cancel only from pending
Once (or if) the session returns to
pending, cancel is safe to call (API reference):Related
Session lifecycle
Full cancellation and TTL behavior.
API errors
The full error reference, including
session:invalid_state.Handle failures
All ten failure scenarios, symptom → page.