Create a checkout session
POST/checkout/session
Create a checkout session
Request
- application/json
Body
required
- Array [
- ]
- Array [
- ]
Enables user redeemable promotion codes.
The URL to which the customers is redirected when payment or setup is complete.
If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website.
Three-letter ISO currency code, in lowercase. Must be a supported currency.
ID of an existing Customer, if one exists. If blank, a new Customer object based on information provided during the payment flow will be created.
discounts object[]
The coupon to apply. Currently, only up to one may be specified.
The ID of the coupon to apply.
line_items object[]required
A list of items the customer is purchasing.
For payment
mode, 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 subscription
mode, there is a maximum of 20 line items with recurring Prices and 20 line items with one-time Prices.
adjustable_quantity object
Set to true if the quantity can be adjusted to any non-negative integer. By default customers will be able to remove the line item by setting the quantity to 0.
Possible values: <= 999999
The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999999.
The minimum quantity the customer must purchase. By default this value is 0.
The ID of the Price object.
Possible values: >= 1
The quantity of the line item being purchased.
Possible values: [subscription
, payment
]
The mode of the Session. Pass subscription
if it includes at least one recurring item.
Possible values: [card
, paypal
, customer_balance
]
Default value: card
subscription_data objectrequired
Possible values: >= 1
Integer representing the number of trial period days before the customer is charged for the first time.
Specifies which fields in the response should be expanded.
Responses
- 201
- application/json
- Schema
- Example (from schema)
Schema
{
"url": "string"
}