Skip to main content
POST
/
api
/
payments
/
checkout-sessions
Create Checkout Session
curl --request POST \
  --url https://api.example.com/api/payments/checkout-sessions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "environment": "test",
  "mode": "subscription",
  "lineItems": [
    {
      "stripePriceId": "price_123",
      "quantity": 1
    }
  ],
  "successUrl": "https://app.example.com/billing/success",
  "cancelUrl": "https://app.example.com/billing/cancel",
  "subject": {
    "type": "team",
    "id": "team_123"
  },
  "customerEmail": "buyer@example.com",
  "idempotencyKey": "checkout-team_123-pro"
}
'
{
  "checkoutSession": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "environment": "test",
    "mode": "payment",
    "status": "initialized",
    "paymentStatus": "paid",
    "subjectType": "<string>",
    "subjectId": "<string>",
    "customerEmail": "jsmith@example.com",
    "stripeCheckoutSessionId": "cs_test_123",
    "stripeCustomerId": "cus_123",
    "stripePaymentIntentId": "pi_123",
    "stripeSubscriptionId": "sub_123",
    "url": "https://checkout.stripe.com/c/pay/cs_test_123",
    "lastError": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.insforge.dev/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Metadata keys starting with insforge_ are reserved and rejected.

environment
enum<string>
required
Available options:
test,
live
mode
enum<string>
required
Available options:
payment,
subscription
lineItems
object[]
required
Required array length: 1 - 100 elements
successUrl
string<uri>
required
cancelUrl
string<uri>
required
subject
object
customerEmail
string<email> | null
metadata
object
idempotencyKey
string
Required string length: 1 - 200

Response

Checkout Session created

checkoutSession
object
required