Skip to main content
POST
Create a checkout session

Authorizations

Authorization
string
header
default:easner_sk_test_…
required

A secret key, easner_sk_test_… or easner_sk_live_…, as Authorization: Bearer. Each key has one business, one mode and fixed scopes. Transfer routes also accept a transfer's easner_ta_… secret for the customer.

Headers

Idempotency-Key
string

Up to 255 characters. Keys are scoped to your business and mode. Longer is 400 invalid_idempotency_key. Honoured only on the operations marked idempotent.

Maximum string length: 255

Body

application/json

One of amount (single line), line_items (up to 20), or a catalog price. Amounts are cents and come from this call only.

mode
enum<string>
default:payment
Available options:
payment,
subscription
amount
integer

Amount in cents, for one line without line_items.

Required range: x >= 1
currency
string
default:usd
Pattern: ^[A-Za-z]{3}$
line_items
object[]
Maximum array length: 20
customer
string<uuid>

A checkout customer id of this mode.

customer_email
string<email>
customer_name
string
recurring
object

Subscription billing. Needed for subscription mode without a catalog price.

interval
enum<string>

Older form of recurring.interval.

Available options:
day,
week,
month,
year
interval_count
integer
Required range: 1 <= x <= 52
trial_days
integer

Subscription mode only.

Required range: 0 <= x <= 730
payment_method_collection
enum<string>
default:always

if_required starts a trial without a card. Needs mode: subscription and a trial.

Available options:
always,
if_required
trial_end_behavior
enum<string>
default:pause

With payment_method_collection: if_required, what happens when the trial ends and no card was added.

Available options:
pause,
cancel
allow_promotion_codes
boolean
automatic_tax
collect
object
success_url
string<uri>

A full https address on an allowed website. May contain {CHECKOUT_SESSION_ID}.

cancel_url
string<uri>
expires_in
integer

Seconds until the session expires.

Required range: 1800 <= x <= 86400
metadata
object

String values only. Returned on the session and on checkout webhooks.

Response

The session stored by an earlier call with the same Idempotency-Key.

The session as it was created. client_secret is for the embedded checkout.

object
any
required
id
string
required
Pattern: ^cs_
checkout_session_id
string
required
Pattern: ^cs_
client_secret
string
required
url
string<uri>
required
status
string
required
mode
enum<string>
required
Available options:
payment,
subscription
amount
integer
required
amount_total
integer
required
amount_due_today
integer
required
currency
string
required
line_items
object[]
required
customer
string<uuid> | null
required
customer_email
string | null
required
customer_name
string | null
required
metadata
object
required
expires_at
string<date-time>
required
livemode
boolean
required
trial_days
integer | null
payment_method_collection
enum<string>
Available options:
always,
if_required
trial_end_behavior
enum<string> | null
Available options:
pause,
cancel,
null