# checkout.session

From **Stripe API**.

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).

- Type: `object`

## Properties

### `after_expiration`

- Required: false
- Nullable: true

When set, provides configuration for actions to take if this Checkout Session expires.

### `allow_promotion_codes`

- Required: false
- Type: `boolean`
- Nullable: true

Enables user redeemable promotion codes.

### `amount_subtotal`

- Required: false
- Type: `integer`
- Nullable: true

Total of all items before discounts or taxes are applied.

### `amount_total`

- Required: false
- Type: `integer`
- Nullable: true

Total of all items after discounts and taxes are applied.

### `automatic_tax`

- Required: true
- Type: `object`

### `billing_address_collection`

- Required: false
- Type: `string`
- Nullable: true
- Allowed values: `"auto"`, `"required"`

Describes whether Checkout should collect the customer's billing address.

### `cancel_url`

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

The URL the customer will be directed to if they decide to cancel payment and return to your website.

### `client_reference_id`

- Required: false
- Type: `string`
- Nullable: true
- maxLength: `5000`

A unique string to reference the Checkout Session. This can be a
customer ID, a cart ID, or similar, and can be used to reconcile the
Session with your internal systems.

### `consent`

- Required: false
- Nullable: true

Results of `consent_collection` for this session.

### `consent_collection`

- Required: false
- Nullable: true

When set, provides configuration for the Checkout Session to gather active consent from customers.

### `currency`

- Required: false
- Type: `string`
- Nullable: true

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).

### `customer`

- Required: false
- Nullable: true

The ID of the customer for this Session.
For Checkout Sessions in `payment` or `subscription` mode, Checkout
will create a new customer object based on information provided
during the payment flow unless an existing customer was provided when
the Session was created.

### `customer_details`

- Required: false
- Nullable: true

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.

### `customer_email`

- Required: false
- Type: `string`
- Nullable: true
- maxLength: `5000`

If provided, this value will be used when the Customer object is created.
If not provided, customers will be asked to enter their email address.
Use this parameter to prefill customer data if you already have an email
on file. To access information about the customer once the payment flow is
complete, use the `customer` attribute.

### `expires_at`

- Required: true
- Type: `integer`
- Format: `unix-time`

The timestamp at which the Checkout Session will expire.

### `id`

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

Unique identifier for the object. Used to pass to `redirectToCheckout`
in Stripe.js.

### `line_items`

- Required: false
- Type: `object`

The line items purchased by the customer.

### `livemode`

- Required: true
- Type: `boolean`

Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.

### `locale`

- Required: false
- Type: `string`
- Nullable: true
- Allowed values: `"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"`

The IETF language tag of the locale Checkout is displayed in. If blank or `auto`, the browser's locale is used.

### `metadata`

- Required: false
- Type: `object`
- Nullable: true

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.

### `mode`

- Required: true
- Type: `string`
- Allowed values: `"payment"`, `"setup"`, `"subscription"`

The mode of the Checkout Session.

### `object`

- Required: true
- Type: `string`
- Allowed values: `"checkout.session"`

String representing the object's type. Objects of the same type share the same value.

### `payment_intent`

- Required: false
- Nullable: true

The ID of the PaymentIntent for Checkout Sessions in `payment` mode.

### `payment_method_options`

- Required: false
- Nullable: true

Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.

### `payment_method_types`

- Required: true
- Type: `array`

A list of the types of payment methods (e.g. card) this Checkout
Session is allowed to accept.

### `payment_status`

- Required: true
- Type: `string`
- Allowed values: `"no_payment_required"`, `"paid"`, `"unpaid"`

The payment status of the Checkout Session, one of `paid`, `unpaid`, or `no_payment_required`.
You can use this value to decide when to fulfill your customer's order.

### `phone_number_collection`

- Required: false
- Type: `object`

### `recovered_from`

- Required: false
- Type: `string`
- Nullable: true
- maxLength: `5000`

The ID of the original expired Checkout Session that triggered the recovery flow.

### `setup_intent`

- Required: false
- Nullable: true

The ID of the SetupIntent for Checkout Sessions in `setup` mode.

### `shipping`

- Required: false
- Nullable: true

Shipping information for this Checkout Session.

### `shipping_address_collection`

- Required: false
- Nullable: true

When set, provides configuration for Checkout to collect a shipping address from a customer.

### `shipping_options`

- Required: true
- Type: `array`

The shipping rate options applied to this Session.

### `shipping_rate`

- Required: false
- Nullable: true

The ID of the ShippingRate for Checkout Sessions in `payment` mode.

### `status`

- Required: false
- Type: `string`
- Nullable: true
- Allowed values: `"complete"`, `"expired"`, `"open"`

The status of the Checkout Session, one of `open`, `complete`, or `expired`.

### `submit_type`

- Required: false
- Type: `string`
- Nullable: true
- Allowed values: `"auto"`, `"book"`, `"donate"`, `"pay"`

Describes the type of transaction being performed by Checkout in order to customize
relevant text on the page, such as the submit button. `submit_type` can only be
specified on Checkout Sessions in `payment` mode, but not Checkout Sessions
in `subscription` or `setup` mode.

### `subscription`

- Required: false
- Nullable: true

The ID of the subscription for Checkout Sessions in `subscription` mode.

### `success_url`

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

The URL the customer will be directed to after the payment or
subscription creation is successful.

### `tax_id_collection`

- Required: false
- Type: `object`

### `total_details`

- Required: false
- Nullable: true

Tax and discount details for the computed total amount.

### `url`

- Required: false
- Type: `string`
- Nullable: true
- maxLength: `5000`

The URL to the Checkout Session.

## JSON Schema

```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"}
```
