# PostCheckoutSessionsSessionExpire

From **Stripe API**.

`POST /v1/checkout/sessions/{session}/expire`

<p>A Session can be expired when it is in one of these statuses: <code>open</code> </p>

<p>After it expires, a customer can’t complete a Session and customers loading the Session see a message saying the Session is expired.</p>

## Parameters

### `session`

- Location: path
- Required: true
- Type: `string`
- maxLength: `5000`

## Request body

- Required: false
### `application/x-www-form-urlencoded`

- Type: `object`

```json
{"additionalProperties":false,"properties":{"expand":{"description":"Specifies which fields in the response should be expanded.","items":{"maxLength":5000,"type":"string"},"type":"array"}},"type":"object"}
```

## Security

### `basicAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `basic`
Send credentials in the `Authorization` request header using the `Basic` scheme.

Basic HTTP authentication. Allowed headers-- Authorization: Basic <api_key> | Authorization: Basic <base64 hash of `api_key:`>

### `bearerAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `bearer`
- Bearer format: `auth-scheme`
Send the token in the `Authorization` request header using the `Bearer` scheme.

Bearer HTTP authentication. Allowed headers-- Authorization: Bearer <api_key>

## Responses

### `200`

Successful response.

### `application/json`

- Type: `object`

A Checkout Session represents your customer's session as they pay for
one-time purchases or subscriptions through [Checkout](https://stripe.com/docs/payments/checkout)
or [Payment Links](https://stripe.com/docs/payments/payment-links). We recommend creating a
new Session each time your customer attempts to pay.

Once payment is successful, the Checkout Session will contain a reference
to the [Customer](https://stripe.com/docs/api/customers), and either the successful
[PaymentIntent](https://stripe.com/docs/api/payment_intents) or an active
[Subscription](https://stripe.com/docs/api/subscriptions).

You can create a Checkout Session on your server and pass its ID to the
client to begin Checkout.

Related guide: [Checkout Server Quickstart](https://stripe.com/docs/payments/checkout/api).

```json
{"description":"A Checkout Session represents your customer's session as they pay for\none-time purchases or subscriptions through [Checkout](https://stripe.com/docs/payments/checkout)\nor [Payment Links](https://stripe.com/docs/payments/payment-links). We recommend creating a\nnew Session each time your customer attempts to pay.\n\nOnce payment is successful, the Checkout Session will contain a reference\nto the [Customer](https://stripe.com/docs/api/customers), and either the successful\n[PaymentIntent](https://stripe.com/docs/api/payment_intents) or an active\n[Subscription](https://stripe.com/docs/api/subscriptions).\n\nYou can create a Checkout Session on your server and pass its ID to the\nclient to begin Checkout.\n\nRelated guide: [Checkout Server Quickstart](https://stripe.com/docs/payments/checkout/api).","properties":{"after_expiration":{"anyOf":[{"$ref":"#/components/schemas/payment_pages_checkout_session_after_expiration"}],"description":"When set, provides configuration for actions to take if this Checkout Session expires.","nullable":true},"allow_promotion_codes":{"description":"Enables user redeemable promotion codes.","nullable":true,"type":"boolean"},"amount_subtotal":{"description":"Total of all items before discounts or taxes are applied.","nullable":true,"type":"integer"},"amount_total":{"description":"Total of all items after discounts and taxes are applied.","nullable":true,"type":"integer"},"automatic_tax":{"$ref":"#/components/schemas/payment_pages_checkout_session_automatic_tax"},"billing_address_collection":{"description":"Describes whether Checkout should collect the customer's billing address.","enum":["auto","required"],"nullable":true,"type":"string"},"cancel_url":{"description":"The URL the customer will be directed to if they decide to cancel payment and return to your website.","maxLength":5000,"type":"string"},"client_reference_id":{"description":"A unique string to reference the Checkout Session. This can be a\ncustomer ID, a cart ID, or similar, and can be used to reconcile the\nSession with your internal systems.","maxLength":5000,"nullable":true,"type":"string"},"consent":{"anyOf":[{"$ref":"#/components/schemas/payment_pages_checkout_session_consent"}],"description":"Results of `consent_collection` for this session.","nullable":true},"consent_collection":{"anyOf":[{"$ref":"#/components/schemas/payment_pages_checkout_session_consent_collection"}],"description":"When set, provides configuration for the Checkout Session to gather active consent from customers.","nullable":true},"currency":{"description":"Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).","nullable":true,"type":"string"},"customer":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/customer"},{"$ref":"#/components/schemas/deleted_customer"}],"description":"The ID of the customer for this Session.\nFor Checkout Sessions in `payment` or `subscription` mode, Checkout\nwill create a new customer object based on information provided\nduring the payment flow unless an existing customer was provided when\nthe Session was created.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/customer"},{"$ref":"#/components/schemas/deleted_customer"}]}},"customer_details":{"anyOf":[{"$ref":"#/components/schemas/payment_pages_checkout_session_customer_details"}],"description":"The customer details including the customer's tax exempt status and the customer's tax IDs. Only present on Sessions in `payment` or `subscription` mode.","nullable":true},"customer_email":{"description":"If provided, this value will be used when the Customer object is created.\nIf not provided, customers will be asked to enter their email address.\nUse this parameter to prefill customer data if you already have an email\non file. To access information about the customer once the payment flow is\ncomplete, use the `customer` attribute.","maxLength":5000,"nullable":true,"type":"string"},"expires_at":{"description":"The timestamp at which the Checkout Session will expire.","format":"unix-time","type":"integer"},"id":{"description":"Unique identifier for the object. Used to pass to `redirectToCheckout`\nin Stripe.js.","maxLength":5000,"type":"string"},"line_items":{"description":"The line items purchased by the customer.","properties":{"data":{"description":"Details about each object.","items":{"$ref":"#/components/schemas/item"},"type":"array"},"has_more":{"description":"True if this list has another page of items after this one that can be fetched.","type":"boolean"},"object":{"description":"String representing the object's type. Objects of the same type share the same value. Always has the value `list`.","enum":["list"],"type":"string"},"url":{"description":"The URL where this list can be accessed.","maxLength":5000,"type":"string"}},"required":["data","has_more","object","url"],"title":"PaymentPagesCheckoutSessionListLineItems","type":"object","x-expandableFields":["data"]},"livemode":{"description":"Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.","type":"boolean"},"locale":{"description":"The IETF language tag of the locale Checkout is displayed in. If blank or `auto`, the browser's locale is used.","enum":["auto","bg","cs","da","de","el","en","en-GB","es","es-419","et","fi","fil","fr","fr-CA","hr","hu","id","it","ja","ko","lt","lv","ms","mt","nb","nl","pl","pt","pt-BR","ro","ru","sk","sl","sv","th","tr","vi","zh","zh-HK","zh-TW"],"nullable":true,"type":"string","x-stripeBypassValidation":true},"metadata":{"additionalProperties":{"maxLength":500,"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.","nullable":true,"type":"object"},"mode":{"description":"The mode of the Checkout Session.","enum":["payment","setup","subscription"],"type":"string"},"object":{"description":"String representing the object's type. Objects of the same type share the same value.","enum":["checkout.session"],"type":"string"},"payment_intent":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/payment_intent"}],"description":"The ID of the PaymentIntent for Checkout Sessions in `payment` mode.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/payment_intent"}]}},"payment_method_options":{"anyOf":[{"$ref":"#/components/schemas/checkout_session_payment_method_options"}],"description":"Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.","nullable":true},"payment_method_types":{"description":"A list of the types of payment methods (e.g. card) this Checkout\nSession is allowed to accept.","items":{"maxLength":5000,"type":"string"},"type":"array"},"payment_status":{"description":"The payment status of the Checkout Session, one of `paid`, `unpaid`, or `no_payment_required`.\nYou can use this value to decide when to fulfill your customer's order.","enum":["no_payment_required","paid","unpaid"],"type":"string"},"phone_number_collection":{"$ref":"#/components/schemas/payment_pages_checkout_session_phone_number_collection"},"recovered_from":{"description":"The ID of the original expired Checkout Session that triggered the recovery flow.","maxLength":5000,"nullable":true,"type":"string"},"setup_intent":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/setup_intent"}],"description":"The ID of the SetupIntent for Checkout Sessions in `setup` mode.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/setup_intent"}]}},"shipping":{"anyOf":[{"$ref":"#/components/schemas/shipping"}],"description":"Shipping information for this Checkout Session.","nullable":true},"shipping_address_collection":{"anyOf":[{"$ref":"#/components/schemas/payment_pages_payment_page_resources_shipping_address_collection"}],"description":"When set, provides configuration for Checkout to collect a shipping address from a customer.","nullable":true},"shipping_options":{"description":"The shipping rate options applied to this Session.","items":{"$ref":"#/components/schemas/payment_pages_checkout_session_shipping_option"},"type":"array"},"shipping_rate":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/shipping_rate"}],"description":"The ID of the ShippingRate for Checkout Sessions in `payment` mode.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/shipping_rate"}]}},"status":{"description":"The status of the Checkout Session, one of `open`, `complete`, or `expired`.","enum":["complete","expired","open"],"nullable":true,"type":"string"},"submit_type":{"description":"Describes the type of transaction being performed by Checkout in order to customize\nrelevant text on the page, such as the submit button. `submit_type` can only be\nspecified on Checkout Sessions in `payment` mode, but not Checkout Sessions\nin `subscription` or `setup` mode.","enum":["auto","book","donate","pay"],"nullable":true,"type":"string"},"subscription":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/subscription"}],"description":"The ID of the subscription for Checkout Sessions in `subscription` mode.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/subscription"}]}},"success_url":{"description":"The URL the customer will be directed to after the payment or\nsubscription creation is successful.","maxLength":5000,"type":"string"},"tax_id_collection":{"$ref":"#/components/schemas/payment_pages_checkout_session_tax_id_collection"},"total_details":{"anyOf":[{"$ref":"#/components/schemas/payment_pages_checkout_session_total_details"}],"description":"Tax and discount details for the computed total amount.","nullable":true},"url":{"description":"The URL to the Checkout Session.","maxLength":5000,"nullable":true,"type":"string"}},"required":["automatic_tax","cancel_url","expires_at","id","livemode","mode","object","payment_method_types","payment_status","shipping_options","success_url"],"title":"Session","type":"object","x-expandableFields":["after_expiration","automatic_tax","consent","consent_collection","customer","customer_details","line_items","payment_intent","payment_method_options","phone_number_collection","setup_intent","shipping","shipping_address_collection","shipping_options","shipping_rate","subscription","tax_id_collection","total_details"],"x-resourceId":"checkout.session"}
```

### `default`

Error response.

### `application/json`

- Type: `object`

An error response from the Stripe API

```json
{"description":"An error response from the Stripe API","properties":{"error":{"$ref":"#/components/schemas/api_errors"}},"required":["error"],"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url https://api.stripe.com/v1/checkout/sessions/{session}/expire \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '{
  "expand": [
    "string"
  ]
}'
```
