Create a checkout session
POSThttps://apis.<domain>/checkout/session
Authorization: http
name: bearerTokentype: httpscheme: bearerin: headerdescription: Authorization Header: `Authorization: Bearer <user_token>`
Create a checkout session
Request
- application/json
Body
required
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[]
line_items object[]required
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
Specifies which fields in the response should be expanded.
Responses
- 201
- application/json
- Schema
- Example (from schema)
Schema
{
"url": "string"
}
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X POST 'https://apis.<domain>/checkout/session' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
"allow_promotion_codes": true,
"success_url": "string",
"cancel_url": "string",
"currency": "string",
"customer": "string",
"discounts": [
{
"coupon": "string"
}
],
"line_items": [
{
"adjustable_quantity": {
"enabled": true,
"maximum": 0,
"minimum": 0
},
"price": "string",
"quantity": 0
}
],
"mode": "subscription",
"payment_method_types": [
"card"
],
"subscription_data": {
"trial_period_days": 0
},
"expand": [
"string"
]
}'