Attributes
- idstring
Unique identifier for the object.
- automatic_
tax objectDetails on the state of automatic tax for the session, including the status of the latest tax calculation.
- client_
reference_ nullable stringid 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.
- currencynullable enum
Three-letter ISO currency code, in lowercase. Must be a supported currency.
- customernullable stringExpandable
The ID of the customer for this Session. For Checkout Sessions in
subscriptionmode or Checkout Sessions withcustomer_set ascreation alwaysinpaymentmode, 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_
email nullable stringIf 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
customerattribute. - line_
items nullable objectIncludableThe line items purchased by the customer.
- metadatanullable map
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
- modeenum
The mode of the Checkout Session.
Possible enum valuespaymentAccept one-time payments for cards, iDEAL, and more.
setupSave payment details to charge your customers later.
subscriptionUse Stripe Billing to set up fixed-price subscriptions.
- payment_
intent nullable stringExpandableThe ID of the PaymentIntent for Checkout Sessions in
paymentmode. You can’t confirm or cancel the PaymentIntent for a Checkout Session. To cancel, expire the Checkout Session instead. - payment_
status enumThe payment status of the Checkout Session, one of
paid,unpaid, orno_. You can use this value to decide when to fulfill your customer’s order.payment_ required Possible enum valuesno_payment_ required The Checkout Session is in
setupmode and doesn’t require a payment at this time, or the Session uses a billing cycle anchor with no proration and payment will be collected at the anchor date.paidThe payment funds are available in your account. For subscriptions with a free trial, this indicates that the $0 trial invoice has been successfully processed.
unpaidThe payment funds are not yet available in your account.
- return_
url nullable stringApplies to Checkout Sessions with
ui_ormode: embedded_ page ui_. The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method’s app or site.mode: elements - statusnullable enum
The status of the Checkout Session, one of
open,complete, orexpired.Possible enum valuescompleteThe checkout session is complete. Payment processing may still be in progress
expiredThe checkout session has expired. No further processing will occur
openThe checkout session is still in progress. Payment processing has not started
- success_
url nullable stringThe URL the customer will be directed to after the payment or subscription creation is successful.
- ui_
mode nullable enumThe UI mode of the Session. Defaults to
hosted_.page Possible enum valueselementsThe Checkout Session is displayed using Checkout elements on your website.
embedded_page The Checkout Session is displayed as an embedded form on your website.
formThe Checkout Session is displayed using the Checkout form on your website.
hosted_page The Checkout Session is displayed on a hosted page that customers get redirected to.
- urlnullable string
The URL to the Checkout Session. Applies to Checkout Sessions with
ui_. Redirect customers to this URL to take them to Checkout. If you’re using Custom Domains, the URL will use your subdomain. Otherwise, it’ll usemode: hosted_ page checkout.This value is only present when the session is active.stripe. com.
More attributes
- objectstring, value is "checkout.session"
- adaptive_
pricing nullable object - after_
expiration nullable object - allow_
promotion_ nullable booleancodes - allowed_
payment_ nullable array of stringsmethod_ types - amount_
subtotal nullable integer - amount_
total nullable integer - billing_
address_ nullable enumcollection - branding_
settings nullable object - cancel_
url nullable string - client_
secret nullable string - collected_
information nullable object - consentnullable object
- consent_
collection nullable object - createdtimestamp
- currency_
conversion nullable object - custom_
fields array of objects - custom_
text object - customer_
account nullable string - customer_
creation nullable enum - customer_
details nullable object - discountsnullable array of objects
- excluded_
payment_ nullable array of stringsmethod_ types - expires_
at timestamp - integration_
identifier nullable string - invoicenullable stringExpandable
- invoice_
creation nullable object - livemodeboolean
- localenullable enum
- managed_
payments nullable object - name_
collection nullable object - optional_
items nullable array of objectsIncludable - origin_
context nullable enum - payment_
link nullable stringExpandable - payment_
method_ nullable enumcollection - payment_
method_ nullable objectconfiguration_ details - payment_
method_ nullable objectoptions - payment_
method_ array of stringstypes - permissionsnullable object
- phone_
number_ nullable objectcollection - presentment_
details nullable object - recovered_
from nullable string - redirect_
on_ nullable enumcompletion - saved_
payment_ nullable objectmethod_ options - setup_
intent nullable stringExpandable - shipping_
address_ nullable objectcollection - shipping_
cost nullable object - shipping_
options array of objects - submit_
type nullable enum - subscriptionnullable stringExpandable
- tax_
id_ nullable objectcollection - total_
details nullable object - wallet_
options nullable object
{ "id": "cs_test_a11YYufWQzNY63zpQ6QSNRQhkUpVph4WRmzW0zWJO2znZKdVujZ0N0S22u", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": null, "amount_subtotal": 2198, "amount_total": 2198, "automatic_tax": { "enabled": false, "liability": null, "status": null }, "billing_address_collection": null, "cancel_url": null, "client_reference_id": null, "consent": null, "consent_collection": null, "created": 1679600215, "currency": "usd", "custom_fields": [], "custom_text": { "shipping_address": null, "submit": null }, "customer": null, "customer_creation": "if_required", "customer_details": null, "customer_email": null, "expires_at": 1679686615, "invoice": null, "invoice_creation": { "enabled": false, "invoice_data": { "account_tax_ids": null, "custom_fields": null, "description": null, "footer": null, "issuer": null, "metadata": {}, "rendering_options": null } }, "livemode": false, "locale": null, "metadata": {}, "mode": "payment", "payment_intent": null, "payment_link": null, "payment_method_collection": "always", "payment_method_options": {}, "payment_method_types": [ "card" ], "payment_status": "unpaid", "phone_number_collection": { "enabled": false }, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "open", "submit_type": null, "subscription": null, "success_url": "https://example.com/success", "total_details": { "amount_discount": 0, "amount_shipping": 0, "amount_tax": 0 }, "return_url": null, "ui_mode": "hosted_page", "url": "https://checkout.stripe.com/c/pay/cs_test_a11YYufWQzNY63zpQ6QSNRQhkUpVph4WRmzW0zWJO2znZKdVujZ0N0S22u#fidkdWxOYHwnPyd1blpxYHZxWjA0SDdPUW5JbmFMck1wMmx9N2BLZjFEfGRUNWhqTmJ%2FM2F8bUA2SDRySkFdUV81T1BSV0YxcWJcTUJcYW5rSzN3dzBLPUE0TzRKTTxzNFBjPWZEX1NKSkxpNTVjRjN8VHE0YicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl"}Creates a Checkout Session object.
Parameters
- automatic_
tax objectSettings for automatic tax lookup for this session and resulting payments, invoices, and subscriptions.
- client_
reference_ stringid 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.
The maximum length is 200 characters.
- customerstring
ID of an existing Customer, if one exists. In
paymentmode, the customer’s most recently saved card payment method will be used to prefill the email, name, card details, and billing address on the Checkout page. Insubscriptionmode, the customer’s default payment method will be used if it’s a card, otherwise the most recently saved card will be used. A valid billing address, billing name and billing email are required on the payment method for Checkout to prefill the customer’s card details.If the Customer already has a valid email set, the email will be prefilled and not editable in Checkout. If the Customer does not have a valid
email, Checkout will set the email entered during the session on the Customer.If blank for Checkout Sessions in
subscriptionmode or withcustomer_set ascreation alwaysinpaymentmode, Checkout will create a new Customer object based on information provided during the payment flow.You can set
payment_to have Checkout automatically attach the payment method to the Customer you pass in for future reuse.intent_ data. setup_ future_ usage - customer_
email stringIf 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 a session is complete, use the
customerfield.The maximum length is 800 characters.
- line_
items array of objectsRequired conditionallyA list of items the customer is purchasing. Use this parameter to pass one-time or recurring Prices. The parameter is required for
paymentandsubscriptionmode.For
paymentmode, there is a maximum of 100 line items, however it is recommended to consolidate line items if there are more than a few dozen.For
subscriptionmode, there is a maximum of 20 line items with recurring Prices and 20 line items with one-time Prices. Line items with one-time Prices will be on the initial invoice only. - metadatamap
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata. - modeenumRequired
The mode of the Checkout Session. Pass
subscriptionif the Checkout Session includes at least one recurring item.Possible enum valuespaymentAccept one-time payments for cards, iDEAL, and more.
setupSave payment details to charge your customers later.
subscriptionUse Stripe Billing to set up fixed-price subscriptions.
- return_
url stringRequired conditionallyThe URL to redirect your customer back to after they authenticate or cancel their payment on the payment method’s app or site. This parameter is required if
ui_ismode embedded_orpage elementsand redirect-based payment methods are enabled on the session. - success_
url stringRequired conditionallyThe URL to which Stripe should send customers when payment or setup is complete. This parameter is not allowed if ui_mode is
embedded_orpage elements. If you’d like to use information from the successful Checkout Session on your page, read the guide on customizing your success page. - ui_
mode enumThe UI mode of the Session. Defaults to
hosted_.page Possible enum valueselementsThe Checkout Session is displayed using Checkout elements on your website.
embedded_page The Checkout Session is displayed as an embedded form on your website.
formThe Checkout Session is displayed using the Checkout form on your website.
hosted_page The Checkout Session is displayed on a hosted page that customers get redirected to.
More parameters
- adaptive_
pricing object - after_
expiration object - allow_
promotion_ booleancodes - allowed_
payment_ array of enumsmethod_ types - billing_
address_ enumcollection - branding_
settings object - cancel_
url string - consent_
collection object - currencyenumRequired conditionally
- custom_
fields array of objects - custom_
text object - customer_
account string - customer_
creation enum - customer_
update object - discountsarray of objects
- excluded_
payment_ array of enumsmethod_ types - expires_
at timestamp - integration_
identifier string - invoice_
creation object - localeenum
- managed_
payments object - name_
collection object - optional_
items array of objects - origin_
context enum - payment_
intent_ objectdata - payment_
method_ enumcollection - payment_
method_ stringconfiguration - payment_
method_ objectdata - payment_
method_ objectoptions - permissionsobject
- phone_
number_ objectcollection - redirect_
on_ enumcompletion - saved_
payment_ objectmethod_ options - setup_
intent_ objectdata - shipping_
address_ objectcollection - shipping_
options array of objects - submit_
type enum - subscription_
data object - tax_
id_ objectcollection - wallet_
options object
Returns
Returns a Checkout Session object.
curl https://api.stripe.com/v1/checkout/sessions \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ --data-urlencode "success_url=https://example.com/success" \ -d "line_items[0][price]={{PRICE_ID}}" \ -d "line_items[0][quantity]=2" \ -d mode=payment{ "id": "cs_test_a11YYufWQzNY63zpQ6QSNRQhkUpVph4WRmzW0zWJO2znZKdVujZ0N0S22u", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": null, "amount_subtotal": 2198, "amount_total": 2198, "automatic_tax": { "enabled": false, "liability": null, "status": null }, "billing_address_collection": null, "cancel_url": null, "client_reference_id": null, "consent": null, "consent_collection": null, "created": 1679600215, "currency": "usd", "custom_fields": [], "custom_text": { "shipping_address": null, "submit": null }, "customer": null, "customer_creation": "if_required", "customer_details": null, "customer_email": null, "expires_at": 1679686615, "invoice": null, "invoice_creation": { "enabled": false, "invoice_data": { "account_tax_ids": null, "custom_fields": null, "description": null, "footer": null, "issuer": null, "metadata": {}, "rendering_options": null } }, "livemode": false, "locale": null, "metadata": {}, "mode": "payment", "payment_intent": null, "payment_link": null, "payment_method_collection": "always", "payment_method_options": {}, "payment_method_types": [ "card" ], "payment_status": "unpaid", "phone_number_collection": { "enabled": false }, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "open", "submit_type": null, "subscription": null, "success_url": "https://example.com/success", "total_details": { "amount_discount": 0, "amount_shipping": 0, "amount_tax": 0 }, "return_url": null, "ui_mode": "hosted_page", "url": "https://checkout.stripe.com/c/pay/cs_test_a11YYufWQzNY63zpQ6QSNRQhkUpVph4WRmzW0zWJO2znZKdVujZ0N0S22u#fidkdWxOYHwnPyd1blpxYHZxWjA0SDdPUW5JbmFMck1wMmx9N2BLZjFEfGRUNWhqTmJ%2FM2F8bUA2SDRySkFdUV81T1BSV0YxcWJcTUJcYW5rSzN3dzBLPUE0TzRKTTxzNFBjPWZEX1NKSkxpNTVjRjN8VHE0YicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl"}Updates a Checkout Session object.
Related guide: Dynamically update a Checkout Session
Parameters
- line_
items array of objectsA list of items the customer is purchasing.
When updating line items, you must retransmit the entire array of line items.
To retain an existing line item, specify its
id.To update an existing line item, specify its
idalong with the new values of the fields to update.To add a new line item, specify one of
priceorprice_anddata quantity.To remove an existing line item, omit the line item’s ID from the retransmitted array.
To reorder a line item, specify it at the desired position in the retransmitted array.
- metadatamap
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata.
More parameters
- collected_
information object - payment_
intent_ objectdata - shipping_
options array of objects
Returns
Returns a Checkout Session object.
{ "id": "cs_test_a11YYufWQzNY63zpQ6QSNRQhkUpVph4WRmzW0zWJO2znZKdVujZ0N0S22u", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": null, "amount_subtotal": 2198, "amount_total": 2198, "automatic_tax": { "enabled": false, "liability": null, "status": null }, "billing_address_collection": null, "cancel_url": null, "client_reference_id": null, "consent": null, "consent_collection": null, "created": 1679600215, "currency": "usd", "custom_fields": [], "custom_text": { "shipping_address": null, "submit": null }, "customer": null, "customer_creation": "if_required", "customer_details": null, "customer_email": null, "expires_at": 1679686615, "invoice": null, "invoice_creation": { "enabled": false, "invoice_data": { "account_tax_ids": null, "custom_fields": null, "description": null, "footer": null, "issuer": null, "metadata": {}, "rendering_options": null } }, "livemode": false, "locale": null, "metadata": { "order_id": "6735" }, "mode": "payment", "payment_intent": null, "payment_link": null, "payment_method_collection": "always", "payment_method_options": {}, "payment_method_types": [ "card" ], "payment_status": "unpaid", "phone_number_collection": { "enabled": false }, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "open", "submit_type": null, "subscription": null, "success_url": "https://example.com/success", "total_details": { "amount_discount": 0, "amount_shipping": 0, "amount_tax": 0 }, "return_url": null, "ui_mode": "hosted_page", "url": "https://checkout.stripe.com/c/pay/cs_test_a11YYufWQzNY63zpQ6QSNRQhkUpVph4WRmzW0zWJO2znZKdVujZ0N0S22u#fidkdWxOYHwnPyd1blpxYHZxWjA0SDdPUW5JbmFMck1wMmx9N2BLZjFEfGRUNWhqTmJ%2FM2F8bUA2SDRySkFdUV81T1BSV0YxcWJcTUJcYW5rSzN3dzBLPUE0TzRKTTxzNFBjPWZEX1NKSkxpNTVjRjN8VHE0YicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl"}