> ## Documentation Index
> Fetch the complete documentation index at: https://docs.r28.ai/charter/llms.txt
> Use this file to discover all available pages before exploring further.

# checkout_sessions_create

> Create a Checkout Session and get a hosted payment URL. Pass `line_items` with price IDs and quantities, `mode='payment'` for one-time or `mode='subscription'` for recurring.

<div className="tool-route"><span className="tool-row-method" data-method="POST">POST</span><code>{"https://api.stripe.com/v1/checkout/sessions"}</code></div>

```python stripe_checkout_sessions_create.py theme={null}
from charter.packs import stripe

result = await stripe.checkout_sessions_create.ainvoke({"mode": ...})
```

## Body

<div className="reference-table">
  | Field                                                        | Type                                                                | Description                                                                                                                                                                                   |
  | ------------------------------------------------------------ | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `mode` <span className="required" title="required">\*</span> | [CheckoutMode](/charter/charter/packs/stripe/checkout/objects#checkoutmode) | The mode of the Checkout Session. Pass 'subscription' if the session includes at least one recurring item, 'payment' for one-time payments, 'setup' to save payment details for later.        |
  | `lineItems`                                                  | [LineItem](/charter/charter/packs/stripe/checkout/objects#lineitem)\[]      | A list of items the customer is purchasing. Required for 'payment' and 'subscription' mode.                                                                                                   |
  | `successUrl`                                                 | `string`                                                            | The URL to send customers to when payment or setup is complete. Required for the default hosted flow, and not allowed if ui\_mode is 'embedded\_page', 'elements' or 'form'.                  |
  | `cancelUrl`                                                  | `string`                                                            | If set, Checkout displays a back button and sends customers here if they cancel.                                                                                                              |
  | `customer`                                                   | `string`                                                            | ID of an existing Customer, if one exists.                                                                                                                                                    |
  | `customerEmail`                                              | `string`                                                            | Prefills the customer's email. If not provided, customers are asked to enter it. <span className="field-constraints">max length 800</span>                                                    |
  | `clientReferenceId`                                          | `string`                                                            | A unique string to reference the Checkout Session — a customer ID, a cart ID — used to reconcile the session with your own systems. <span className="field-constraints">max length 200</span> |
  | `currency`                                                   | `string`                                                            | Three-letter ISO currency code, in lowercase. Required in 'setup' mode when payment\_method\_types is not set.                                                                                |
  | `expiresAt`                                                  | `integer`                                                           | The Epoch time in seconds at which the session expires. Between 30 minutes and 24 hours after creation; defaults to 24 hours. Seconds, not milliseconds: 1700000000, not 1700000000000.       |
  | `allowPromotionCodes`                                        | `boolean`                                                           | Enables user-redeemable promotion codes.                                                                                                                                                      |
  | `uiMode`                                                     | [UiMode](/charter/charter/packs/stripe/checkout/objects#uimode)             | The UI mode of the session. Defaults to 'hosted\_page'.                                                                                                                                       |
  | `returnUrl`                                                  | `string`                                                            | Where to send the customer after they authenticate or cancel. Required if ui\_mode is 'embedded\_page', 'elements' or 'form' with redirect-based methods.                                     |
  | `metadata`                                                   | map of `string`                                                     | Set of key-value pairs attached to the session.                                                                                                                                               |
</div>
