Checkout sessions
Expire a checkout session
End a session now, so its link can no longer be paid. For a cart your customer abandoned or an order that changed. The session becomes `expired` and `checkout.session.expired` is sent, once. Expiring a session that has already expired returns it unchanged with 200, so a retry is safe. Only a session nobody has started paying can be expired. While a payment is in progress the answer is 409 `CHECKOUT_IN_PROGRESS`: that money may still arrive, and the session will end as `complete` or `failed` by itself. A session that is already `complete` or `failed` is 409 `CHECKOUT_SESSION_CLOSED`. The payer pressing Cancel on the checkout page does not expire the session: they are sent to your `cancel_url` and may come back and pay before `expires_at`. If you want the link dead once they cancel, call this from your `cancel_url` handler. `expires_at` keeps its original value, so an `expired_at` before it shows the session was ended early.
Before you call this endpoint
- An API key needs the
payments:writescope. - Once your business has an IP allowlist, every live key must call from an address on it.
- Guide: End a session early
End a session now, so its link can no longer be paid.
For a cart your customer abandoned or an order that changed. The session
becomes expired and checkout.session.expired is sent, once. Expiring a
session that has already expired returns it unchanged with 200, so a
retry is safe.
Only a session nobody has started paying can be expired. While a payment
is in progress the answer is 409 CHECKOUT_IN_PROGRESS: that money may
still arrive, and the session will end as complete or failed by
itself. A session that is already complete or failed is 409
CHECKOUT_SESSION_CLOSED.
The payer pressing Cancel on the checkout page does not expire the session:
they are sent to your cancel_url and may come back and pay before
expires_at. If you want the link dead once they cancel, call this from
your cancel_url handler. expires_at keeps its original value, so an
expired_at before it shows the session was ended early.
Path Parameters
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/b/v1/checkout/sessions/string/expire"{ "id": "string", "url": "string", "status": "string", "is_test": true, "amount_minor": 0, "currency": "string", "reference": "string", "customer": { "name": "Aline Uwase", "email": "aline@example.com", "phone": "250788123456" }, "methods": [ "string" ], "success_url": "string", "cancel_url": "string", "metadata": {}, "embed_origins": [ "string" ], "account": "acct_4f1c9a2b7d3e8f6a0b1c2d3e", "charge_id": "cf8b747b-a752-4d0a-9a4d-7d19fc1769f3", "failure_reason": "string", "expires_at": "2019-08-24T14:15:22Z", "created_at": "2019-08-24T14:15:22Z", "completed_at": "2019-08-24T14:15:22Z", "expired_at": "2019-08-24T14:15:22Z", "failed_at": "2019-08-24T14:15:22Z"}Fetch a checkout session
Verify a session from your server before you fulfil the order. `status: complete` with a `charge_id` is the confirmation. Another business's session, a session in the other mode and no session all give the same 404.
List charges
Most recent first, scoped to your business and your key's mode.