Create a Session
POST
/v1/checkout/sessionsCreates a Session object.
Request
Describes whether Checkout should collect the customer’s billing address.
The URL the customer will be directed to if they decide to cancel payment and return to your website.
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 ID of the customer for this Session.
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.
The timestamp at which the Checkout Session will expire. The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 1 to 24 hours after Checkout Session creation. By default, this value is 24 hours from creation.
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.
The mode of the Checkout Session. Only payment is supported now.
Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.
Details on the state of phone number collection for the session. phone_number_collection.enabled boolean Indicates whether phone number collection is enabled for the session
Indicates whether phone number collection is enabled for the session.
When set, provides configuration for Checkout to collect a shipping address from a customer.
An array of two-letter ISO country codes representing which countries Checkout should provide as options for shipping locations.
The URL the customer will be directed to after the payment or subscription creation is successful.
Enables user redeemable promotion codes.
Configure whether a Checkout Session creates a Customer when the Checkout Session completes. Can only be set in payment and setup mode.
A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in payment mode.
Controls when the funds will be captured from the customer’s account. Possible enum values:automatic(default) and manual
An arbitrary string attached to the object. Often useful for displaying to users.
The order ID created in the merchant's order system that corresponds to this PaymentIntent
The user ID created in merchant's order system that corresponds to this PaymentIntent
A 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.
A list of items the customer is purchasing. Use this parameter to pass one-time or recurring Prices.
Required conditionally. The ID of the Price object. One of price or price_data is required.
Required conditionally.Data used to generate a new Price object inline. One of price or price_data is required. For more details of price_data, please refer to the endpoint of 'create a price'.
Required unless metered billing. The quantity of the line item being purchased.
The coupon or promotion code to apply to this Session. Currently, only up to one may be specified.
The ID of the coupon to apply to this Session.
This parameter indicates how many billing cycles the discount applies to in the subscription. The default value is 1.
Integer representing the number of trial period days before the customer is charged for the first time. Has to be at least 1.
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.
{
"cancel_url": "https://yourwebsite.com",
"mode": "payment",
"success_url": "https://yourwebsite.com",
"line_items": [
{
"price_data": {
"currency": "GBP",
"unit_amount": 2000,
"product_data": {
"name": "apple"
}
},
"quantity": 1
}
]
}
Request samples
Responses
Unique identifier for the object, like "cs_xxx" in live environment and "cs_test_xxx" in test environment.
value is "checkout.session"
Total of all items before discounts or taxes are applied.
Total of all items after discounts and taxes are applied.
Describes whether Checkout should collect the customer’s billing address.
The URL the customer will be directed to if they decide to cancel payment and return to your website.
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.
Time at which the object was created. Measured in seconds since the Unix epoch.
Three-letter ISO currency code
The ID of the customer for this Session.
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.
The timestamp at which the Checkout Session will expire. The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 1 to 24 hours after Checkout Session creation. By default, this value is 24 hours from creation.
Has the value true if the object exists in live mode or the value false if the object exists in test mode.
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.
The mode of the Checkout Session. Only payment is supported now.
The ID of the PaymentIntent for Checkout Sessions in payment mode.
The ID of the Payment Link that created this Session.
Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.
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.
Details on the state of phone number collection for the session. phone_number_collection.enabled boolean Indicates whether phone number collection is enabled for the session
Indicates whether phone number collection is enabled for the session.
When set, provides configuration for Checkout to collect a shipping address from a customer.
An array of two-letter ISO country codes representing which countries Checkout should provide as options for shipping locations.
Shipping information for this Checkout Session.
The delivery service that shipped a physical product, such as FedEx, UPS, USPS, etc.
Recipient name.
Recipient phone (including extension).
The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas.
The status of the Checkout Session, one of open, complete, or expired.
The URL the customer will be directed to after the payment or subscription creation is successful.
The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout.
The line items purchased by the customer. This field is not included by default. To include it in the response, expand the line_items field.
The ID of the subscription for Checkout Sessions in subscription mode.
Configure whether a Checkout Session creates a Customer when the Checkout Session completes. Can only be set in payment and setup mode.
The customer’s address after a completed Checkout Session.
The email associated with the Customer, if one exists, on the Checkout Session after a completed Checkout Session or at time of session expiry.
The customer’s name after a completed Checkout Session.
The customer’s phone number after a completed Checkout Session.
{
"id": "string",
"object": "string",
"amount_subtotal": 0,
"amount_total": 0,
"billing_address_collection": "required",
"cancel_url": "string",
"client_reference_id": "string",
"created": 0,
"currency": "string",
"customer": "string",
"customer_email": "string",
"expires_at": 0,
"livemode": true,
"metadata": {},
"mode": "string",
"payment_intent": "string",
"payment_link": "string",
"payment_method_options": {
"card": {
"request_three_d_secure": "any",
"setup_future_usage": "on_session",
"capture_method": "string",
"tax_id": "string"
},
"alipayplus": {
"terminal_type": "APP",
"os_type": "IOS"
},
"alipay_hk": {
"terminal_type": "APP",
"os_type": "IOS"
},
"alipay": {
"terminal_type": "APP",
"os_type": "IOS"
},
"wechat_pay": {
"terminal_type": "WEB",
"client_ip": "string",
"os_type": "IOS",
"openid": "string"
},
"sepa_debit": {},
"akulaku": {
"terminal_type": "WEB",
"os_type": "IOS"
},
"truemoney": {
"terminal_type": "WEB",
"os_type": "IOS"
},
"kakaopay": {
"terminal_type": "WEB",
"os_type": "IOS"
},
"shopeepay": {
"terminal_type": "string",
"os_type": "string"
},
"dana": {
"terminal_type": "string",
"os_type": "string"
},
"pix": {
"tax_id": "string"
}
},
"payment_method_types": [
"string"
],
"payment_status": "string",
"phone_number_collection": {
"enabled": true
},
"shipping_address_collection": {
"allowed_countries": [
"string"
]
},
"shipping": {
"address": {
"city": "string",
"country": "string",
"line1": "string",
"line2": "string",
"postal_code": "string",
"state": "string"
},
"carrier": "string",
"name": "string",
"phone": "string",
"tracking_number": "string"
},
"status": "open",
"success_url": "string",
"url": "string",
"line_items": {
"object": "\"list\"",
"url": "string",
"has_more": true,
"data": [
{
"id": "string",
"object": "string",
"amount_subtotal": "string",
"amount_total": "string",
"currency": "string",
"description": "string",
"price": {
"id": "string",
"object": "string",
"active": true,
"billing_scheme": "per_unit",
"created": 0,
"currency": "string",
"livemode": true,
"lookup_key": "string",
"metadata": {},
"nickname": "string",
"product": "string",
"type": "one_time",
"unit_amount": 0,
"recurring": {
"interval": "day",
"interval_count": 0,
"usage_type": "licensed"
},
"tiers": [
{
"up_to": "string",
"flat_amount": "string",
"unit_amount": "string"
}
]
},
"quantity": "string",
"discounts": [
{
"id": "string",
"object": "string",
"checkout_session": "string",
"coupon": {
"id": "string",
"amount_off": 0,
"currency": "string",
"duration_in_days": "string",
"object": "string",
"created": 0,
"livemode": true,
"metadata": {},
"name": "string",
"percent_off": 0,
"max_redemptions": 0,
"redeem_by": 0,
"times_redeemed": 0,
"valid": true,
"currency_options": {
"<currency>.amount_off": 0
}
},
"customer": "string",
"start": 0,
"end": null,
"promotion_code": null,
"subscription": null
}
],
"amount_discount": 0
}
]
},
"subscription": "string",
"customer_creation": "always",
"customer_details": {
"address": {
"city": "string",
"country": "string",
"line1": "string",
"line2": "string",
"postal_code": "string",
"state": "string"
},
"email": "string",
"name": "string",
"phone": "string"
}
}