---
# @generated by sylphx-gen. Do not edit.
title: "Expire a checkout session"
description: "`money.checkout_sessions.expire` (POST /v1/{name}:expire): Expires an open hosted checkout so it can no longer be paid."
type: reference
product: payments
summary: "Expires an open hosted checkout so it can no longer be paid."
updated: 2026-09-28
nav: false
---

Expires an open hosted checkout so it can no longer be paid.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/checkout_sessions/checkout-session:expire`
- **Scope** `billing:write`
- **Effect** `write` — a successful call changes state.
- **Collection** [checkout_sessions](/docs/api/checkout_sessions)

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | The Money checkout resource to expire. Required. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | `orgs/{org}/projects/{project}/envs/{env}/checkout_sessions/{checkout_session}`. |
| `uid` | `string` | `chk_<cell><ulid>`; never reused. Output only. |
| `meta` | `ResourceMeta` | Resource metadata. |
| `subject` | `Subject` | Who pays and is entitled. Required. |
| `line_items` | `LineItem[]` | What is bought: catalog prices by lookup key. One recurring price makes a subscription; one-time prices make an order. Required. |
| `success_url` | `string` | Where the buyer lands after paying; `{CHECKOUT_SESSION_ID}` is replaced by the processor's session id. HTTPS only. Required. |
| `cancel_url` | `string` | Where the buyer lands on cancel. HTTPS only. |
| `currency_code` | `string` | The currency to charge in, upper-case ISO 4217; default the processor's choice for the buyer among the prices' currencies. |
| `locale` | `string` | The page language, for example `en` or `zh-HK`; default automatic. |
| `metadata` | `map<string, string>` | Copied to the subscription or order, for example attribution (`utm_source`, `ref`). At most 20 keys. |
| `allow_promotion_codes` | `bool` | Whether the buyer may enter a promotion code. |
| `buyer_country_code` | `string` | Where the buyer is, upper-case ISO 3166-1 alpha-2, when the caller knows it (for example from the request's IP address). A country the environment's checkout policy denies is refused here, before any page is made, unless the policy lets a business buy. Not trusted for anything else: the billing address the buyer gives is checked again when the payment completes. |
| `shipping_country_codes` | `string[]` | Countries whose shipping address the hosted page collects, upper-case ISO 3166-1 alpha-2. Empty means no shipping address is collected. |
| `url` | `string` | The hosted page. Output only. |
| `state` | `string` | `open`, `complete`, or `expired`. Output only. |
| `expire_time` | `timestamp` | When the page stops accepting payment. Output only. |
| `processor_session_id` | `string` | The processor's session id. Output only. |
| `denied_reason` | `string` | Why a completed checkout was refused and refunded instead of delivered: `country_denied` (the billing country is on the checkout policy's list) or `country_unknown` (no billing country to check). Empty otherwise. Output only. |
| `billing_country_code` | `string` | The billing country the completed checkout was checked against, upper-case ISO 3166-1 alpha-2; empty until completion. Output only. |
| `billing_subdivision_code` | `string` | The billing state or province, upper-case, kept only for the countries whose tax thresholds are per subdivision (`US`, `CA`); empty otherwise. Nothing else of the buyer's address is stored. Output only. |
| `consent_collection` | `CheckoutConsentCollection` | The consent the hosted page collects before it takes payment, for example a required tick for a withdrawal waiver or the terms of sale. |
| `consent` | `CheckoutConsent` | The consent the buyer gave, recorded once the processor reports it. Output only. |
| `customer_email` | `string` | The buyer's email address, once the hosted checkout has collected it. Output only. |
| `shipping_address` | `ShippingAddress` | The physical delivery address, when `shipping_country_codes` was set and the hosted checkout has collected it. Output only. |
| `amount_total` | `int64` | The processor's current total in minor units, when it has reported one. Output only. |
| `payment_status` | `string` | `unpaid`, `paid`, or `revoked`; empty until a one-time checkout settles. Output only. |
| `livemode` | `bool` | The processor's live/test mode, once the session has reported it. Output only. |
| `processor_payment_id` | `string` | The processor payment this checkout produced; empty before settlement. Output only. |

### ResourceMeta

| Field | Type | What it is |
| --- | --- | --- |
| `generation` | `int64` | Increases by one on every change to `spec`. Output only. |
| `etag` | `string` | Strong ETag (AIP-154): changes on any change to spec, status, or metadata. Send it back as `If-Match` or `etag` to make Update and Delete conditional; a mismatch fails with ABORTED / 409 `ETAG_MISMATCH`. Output only. |
| `create_time` | `timestamp` | When the Resource was created. Output only. |
| `update_time` | `timestamp` | When the Resource last changed. Output only. |
| `delete_time` | `timestamp` | Set while the Resource is being deleted. Output only. |
| `labels` | `map<string, string>` | Caller-writable, indexed labels (AIP-122 label rules). |
| `annotations` | `map<string, string>` | Caller-writable, unindexed annotations. |
| `display_name` | `string` | Caller-writable human-readable name. |
| `creator` | `string` | The principal that created the Resource. Output only. |

### Subject

| Field | Type | What it is |
| --- | --- | --- |
| `end_user` | `string` | An end user's id (Sylphx Auth, or the app's own OIDC issuer). One of the `kind` group. |
| `customer_organization` | `string` | A customer organization's id. One of the `kind` group. |

### LineItem

| Field | Type | What it is |
| --- | --- | --- |
| `price` | `string` | The price's lookup key. Required. |
| `quantity` | `int32` | How many; default 1. Seats for a per-seat or family price. |

### CheckoutConsentCollection

| Field | Type | What it is |
| --- | --- | --- |
| `terms_required` | `bool` | Require a tick accepting `terms_text` before the buyer can pay. The merchant's Stripe account needs a terms of service URL in its public business details; without one the create fails with `processor_terms_url_missing`. |
| `terms_text` | `string` | The wording shown next to the tick; at most 1200 characters. Required with `terms_required`. |
| `terms_version` | `string` | Which version of the wording this is, recorded with the consent as evidence; at most 64 characters. Required with `terms_required`. |
| `promotions` | `bool` | Offer the buyer an opt-in to promotional email where the processor allows it. |

### CheckoutConsent

| Field | Type | What it is |
| --- | --- | --- |
| `terms_accepted` | `bool` | Whether the buyer ticked the terms. Output only. |
| `terms_text` | `string` | The wording the buyer saw. Output only. |
| `terms_version` | `string` | The version of that wording. Output only. |
| `promotions` | `string` | `opt_in`, `opt_out`, or empty when promotions were not asked. Output only. |
| `record_time` | `timestamp` | When Money first recorded the answer. Output only. |

### ShippingAddress

| Field | Type | What it is |
| --- | --- | --- |
| `recipient` | `string` | Recipient name. Output only. |
| `line1` | `string` | First address line. Output only. |
| `line2` | `string` | Optional second address line. Output only. |
| `city` | `string` | City or town. Output only. |
| `region` | `string` | State, county or province. Output only. |
| `postal_code` | `string` | Postcode. Output only. |
| `region_code` | `string` | Upper-case ISO 3166-1 alpha-2 region code. Output only. |

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.
- [`INVALID_STATE`](/docs/api/errors/INVALID_STATE) — The Resource is in a state that forbids the call.
- [`UNAVAILABLE`](/docs/api/errors/UNAVAILABLE) — The Resource store, the owning service's backend, or the key verifier's snapshot is unavailable; retry after Retry-After.
- [`IDEMPOTENCY_KEY_REUSED`](/docs/api/errors/IDEMPOTENCY_KEY_REUSED) — An Idempotency-Key was reused with another body.
- [`IDEMPOTENCY_IN_PROGRESS`](/docs/api/errors/IDEMPOTENCY_IN_PROGRESS) — The first call with this Idempotency-Key is still running.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/checkout_sessions/checkout-session:expire" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

**TypeScript**

```ts
const response = await sylphx.money.checkoutSessions.expire({ name: 'orgs/acme/projects/shop/envs/production/checkout_sessions/checkout-session' })
```

**Rust**

```rust
let mut req = sylphx::money::ExpireCheckoutSessionRequest::default();
req.name = "orgs/acme/projects/shop/envs/production/checkout_sessions/checkout-session".to_string();
let response = sx.money().checkout_sessions().expire(req).await?;
```

**CLI**

```bash
sylphx money checkout-sessions expire orgs/acme/projects/shop/envs/production/checkout_sessions/checkout-session
```

**MCP**

```json
{ "method_id": "money.checkout_sessions.expire", "args": {"name":"orgs/acme/projects/shop/envs/production/checkout_sessions/checkout-session"} }
```
