Skip to content

Expire a checkout session

The checkout.sessions.expire operation: POST /api/v1/checkout/sessions/{id}/expire in the REST API and the checkout_sessions_expire tool in the MCP server.

POST/api/v1/checkout/sessions/{id}/expire

Ends an open or blocked checkout session now, so its link stops working (for example when the cart changed). Emits checkout.session.expired. Expiring an expired session changes nothing. A session that is paid, or whose payment is being processed, can't be expired (checkout_session_not_open).

At a glance

  • REST: POST /api/v1/checkout/sessions/{id}/expire
  • MCP tool: checkout_sessions_expire
  • Operation ID: checkout.sessions.expire
  • Scope: Brand
  • Permission: checkout:write
  • Risk tier: write
  • Dry run: Supported (send Ownrecord-Dry-Run: true)
  • Idempotency: Idempotency-Key required
  • Modes: Test and live
  • Authentication: API key with the checkout:write scope
  • Since: M4

Request

Path parameters

FieldTypeDescription
idcs_… IDThe checkout session's ID (cs_…).

Body

This operation takes no body.

Response

200 OK with a JSON object:

FieldTypeDescription
idcs_… ID
object"checkout.session"
livemodeboolean
entityIdent_… ID
brandIdbrd_… ID
modeone of payment, subscription, topup, setup
statusone of open, processing, complete, expired, blockedopen, blocked (the sale is paused for the customer's location), processing, complete or expired.
urlstring or nullThe hosted page (with its session key); null once complete or expired.
lineItemsarray of object
lineItems[].idstringThe line's ID in the session's quotes and its invoice.
lineItems[].priceIdprice_… ID
lineItems[].productIdprod_… ID
lineItems[].priceTypeone of one_time, credit_pack, recurring
lineItems[].recurringobject or nullRecurring prices (subscription sessions): the billing interval and whether usage is metered.
lineItems[].adjustableQuantityobject or nullThe customer may change the quantity on the hosted page within these bounds.
lineItems[].discountmoney or nullSubscription sessions: what the promotion code takes off this line on the first invoice.
lineItems[].descriptionstringThe product's name when the session was created.
lineItems[].quantityinteger
lineItems[].customAmountmoney or null
lineItems[].amountmoneyBefore tax and discounts: gross for tax-inclusive prices, net for exclusive ones (a recurring price's first full period; zero for metered usage, billed later).
lineItems[].taxBehaviorone of inclusive, exclusive
currencystring
customerIdcus_… ID or null
customerEmailstring or null
successUrlstring or null
cancelUrlstring or null
localestring or null
collectBusinessDetailsone of auto, required, never
allowPromotionCodesbooleanThe hosted page offers a promotion code field.
promotionCodeIdpromo_… ID or nullThe promotion code applied to the session.
subscriptionDataobject or nullSubscription sessions: the trial and the subscription's metadata.
taxQuoteIdtq_… ID or nullThe current quote (tax.quotes.get explains it).
totalsobject or nullThe current quote's totals; null before the customer's details.
blockedReasonone of evidence_conflict, unsupported_tax_category, registration_required, rate_unavailable, jurisdiction_blocked, tax_id_unavailable or null
waitlistEntryIdwl_… ID or null
paymentIdpay_… ID or null
invoiceIdinv_… ID or null
subscriptionIdsub_… ID or nullSubscription sessions: the subscription created; setup sessions: the one the method is for.
paymentMethodIdpm_… ID or nullThe payment method saved (subscription and setup sessions).
expiresAtdate-time
completedAtdate-time or null
createdAtdate-time
metadataobject

Examples

Expire an open session

HTTP
POST /api/v1/checkout/sessions/cs_01m4tx5nj8emwbyf7y9vcf48aa/expire
Authorization: Bearer or_test_…
Idempotency-Key: 3f1c9a52-7d0e-4b8f-9a61-0c2d5e8b7f14

Response (200):

JSON
{
  "id": "cs_01m4tx5nj8emwbyf7y9vcf48aa",
  "object": "checkout.session",
  "livemode": false,
  "entityId": "ent_01m4tx5nj8emwbyf7y9vcf47x2",
  "brandId": "brd_01m4tx5nj8emwbyf7y9vcf47x4",
  "mode": "payment",
  "status": "expired",
  "url": null,
  "lineItems": [
    {
      "id": "1",
      "priceId": "price_01m4tx5nj8emwbyf7y9vcf48ad",
      "productId": "prod_01m4tx5nj8emwbyf7y9vcf48ae",
      "priceType": "credit_pack",
      "recurring": null,
      "adjustableQuantity": null,
      "discount": null,
      "description": "Genno credits",
      "quantity": 1,
      "customAmount": null,
      "amount": {
        "amount": "100000000",
        "currency": "EUR"
      },
      "taxBehavior": "inclusive"
    }
  ],
  "currency": "EUR",
  "customerId": null,
  "customerEmail": "anna@example.com",
  "successUrl": "https://shop.example/thanks",
  "cancelUrl": "https://shop.example/cart",
  "locale": null,
  "collectBusinessDetails": "auto",
  "allowPromotionCodes": false,
  "promotionCodeId": null,
  "subscriptionData": null,
  "taxQuoteId": null,
  "totals": null,
  "blockedReason": null,
  "waitlistEntryId": null,
  "paymentId": null,
  "invoiceId": null,
  "subscriptionId": null,
  "paymentMethodId": null,
  "expiresAt": "2026-10-15T10:00:00.000Z",
  "completedAt": null,
  "createdAt": "2026-10-14T10:00:00.000Z",
  "metadata": {
    "order": "ord_1042"
  }
}

Errors

CodeHTTP statusWhenWhat to do
resource_not_found404No such checkout session for this brand and mode, or (on the hosted page) the session key is missing or wrong.Check the ID and that your credentials are scoped to the right organization, entity, brand and mode.
checkout_session_not_open409The session is complete, expired, or a payment for it is being processed (details.status).The session is complete, expired or waiting for a payment's outcome (details.status). Create a new session for a new purchase.

It can also return these common errors: validation_failed, api_version_unsupported, invalid_json, unsupported_media_type, authentication_required, api_key_invalid, permission_denied, scope_required, idempotency_key_required, idempotency_key_reused, idempotency_in_progress, approval_required, approval_rejected, approval_expired, stale_approval, approval_policy_denied, rate_limited, internal_error.