Skip to main content
POST
/
checkout-sessions
Create Checkout Session
curl --request POST \
  --url https://api.atlas.co/functions/v1/checkout-sessions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "mode": "payment",
  "line_items": [
    {
      "price": "<string>",
      "quantity": 1
    }
  ],
  "success_url": "<string>",
  "cancel_url": "<string>",
  "customer": "<string>",
  "customer_email": "<string>",
  "allow_promotion_codes": true,
  "discounts": [
    {
      "coupon": "<string>"
    }
  ],
  "subscription_data": {
    "trial_period_days": 123
  },
  "expires_at": 123,
  "metadata": {}
}
'
{
  "id": "<string>",
  "object": "checkout.session",
  "mode": "<string>",
  "status": "<string>",
  "url": "<string>",
  "customer": "<string>",
  "customer_email": "<string>",
  "payment_status": "<string>",
  "amount_total": 123,
  "currency": "<string>",
  "line_items": {
    "object": "list",
    "data": [
      {
        "price": "<string>",
        "quantity": 123,
        "amount_total": 123
      }
    ]
  },
  "subscription": "<string>",
  "success_url": "<string>",
  "cancel_url": "<string>",
  "expires_at": 123,
  "metadata": {},
  "created": 123
}

Authorizations

Authorization
string
header
required

API key (sk_test_* or sk_live_*)

Body

application/json
mode
enum<string>
required
Available options:
payment,
subscription
line_items
object[]
required
success_url
string
required
cancel_url
string
required
customer
string
customer_email
string
allow_promotion_codes
boolean
discounts
object[]
subscription_data
object
expires_at
integer
metadata
object

Response

Checkout session created

id
string
object
enum<string>
Available options:
checkout.session
mode
string
status
string
url
string
customer
string
customer_email
string
payment_status
string
amount_total
integer
currency
string
line_items
object
subscription
string
success_url
string
cancel_url
string
expires_at
integer
metadata
object
created
integer