Skip to main content
POST
Create a checkout session

Authorizations

Authorization
string
header
required

Your secret key: sk_test_… for test mode, sk_live_… for live. Server-side only.

Body

application/json
product
string
required
Example:

"prod_9Xk2mQ1pL0vRsT"

success_url
string
required
Example:

"https://acme.test/welcome"

cancel_url
string
required
Example:

"https://acme.test/pricing"

max_duration_seconds
integer

Fix the subscriber's cap. Omit to let them choose on the page (60 s – 30 days).

Required range: 60 <= x <= 2592000

Response

The session. Hand id to <Authorize session> in your own page; there is no hosted page to send anyone to.

id
string
required
Example:

"cs_3fT8kLm2Qp9RxV"

object
enum<string>
required
Available options:
checkout.session
status
enum<string>
required
Available options:
open,
complete,
expired
livemode
boolean
required
created
integer
required
expires_at
integer
required

Unix seconds; 24 h after creation.

success_url
string
required
cancel_url
string
required
product
object
required
merchant
object
required
customer
string | null
required

cus_ id once the subscriber has signed in.

subscription
string | null
required

sub_ id once prepared; retrieve it for status.

max_duration_seconds
integer | null
required
max_escrow_usd
string | null
required

rate × max_duration_seconds, exact decimal.