Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.getopenrails.com/llms.txt

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

POST /api/gateway/sessions

Creates a checkout session and returns a checkoutUrl to redirect the buyer to.
curl https://dash.getopenrails.com/api/gateway/sessions \
  -H "Content-Type: application/json" \
  -d '{
    "product": "Creator plan",
    "amount": 116,
    "customer": "buyer@example.com",
    "preferredRoute": "card",
    "redirectUrl": "https://merchant.example/success?order=ord_284",
    "metadata": {
      "order_id": "ord_284"
    }
  }'

Request body

FieldTypeRequiredDescription
productstringYesProduct or plan name shown on the checkout page.
amountnumberYesAmount in USD. Must be greater than 0.
customerstringYesBuyer email address. Used to look up or create a customer record.
preferredRoutestringNoPreferred route kind: card, wallet, or local.
redirectUrlstringNoURL to redirect the buyer to after checkout completes or fails.
metadataobjectNoUp to 10 key-value string pairs attached to the session.
idempotencyKeystringNoStable key for deduplication. Recommended for order-backed checkouts.
clientReferenceIdstringNoYour internal order or reference ID.
environmentstringNosandbox or production. Defaults to sandbox.

Response

{
  "id": "chk_demo_1779900000000",
  "object": "checkout_session",
  "checkoutUrl": "https://pay.getopenrails.com/checkout/chk_demo_1779900000000",
  "redirectUrl": "https://merchant.example/success?order=ord_284",
  "status": "routed",
  "amount": 116,
  "currency": "USD",
  "customer": "buyer@example.com",
  "metadata": {
    "order_id": "ord_284"
  }
}

Fulfillment rule

Only fulfill orders after receiving a payment.paid webhook event. Do not fulfill on session creation or on payment.provider_pending. See Webhooks for the full event contract.

Status values

StatusMeaning
routedSession created and buyer can be redirected to checkoutUrl.
pendingBuyer has started checkout; payment is in progress.
paidPayment confirmed. Safe to fulfill.
failedPayment failed or timed out.
expiredSession expired before the buyer completed checkout.