Checkouts

Create reusable checkout pages from your own code and get the slug a buy button takes. Every buyer who pays one gets their own payment. The same checkouts you make in the dashboard.

On this page

The checkout object

A checkout is a reusable page with a fixed price, such as a product, a course or a donation: share its link, or put a buy button on your site, and every buyer who pays gets their own payment and order. It's the same checkout you can make under Checkouts in the dashboard. For one amount from one payer, use a payment link; for an order your server prices, a checkout session.

FieldTypeDescription
idstringThe checkout's id, chk_…
objectstring"checkout"
kindstringpage, pricing_table or widget. The API creates pages; the others are made in the dashboard
slugstringWhat a buy button takes: <railbed-button checkout="mug4k7tq2z">
urlstringThe hosted checkout page. Share it, or link to it
livemodebooleanfalse for Test mode, true for Live mode
activebooleanfalse once it was deleted in the dashboard; a deleted checkout takes no new buyers
namestringShown to buyers
descriptionstring or nullShown under the name
amountstringThe price. A pricing table's lowest plan price
currencystringUSD, EUR, GBP, CAD or AUD
success_urlstring or nullWhere buyers land once paid
themestringlight or dark
button_labelstring or nullThe pay button's text, or null for "Continue to pay" and the price
cryptobooleanWhether buyers may pay in crypto, when crypto payments are on for the account
routingobjectHow buyers reach a card provider: choice is smart (Smart Routing), buyer (buyers choose) or fixed (one provider, with fallback to Smart Routing when it can't take a buyer)
collectobject or nullWhat the page asks buyers for besides their email, or null for nothing more. See The collect field
optionsarray or nullA pricing table's two-way switch, such as ["Monthly", "Yearly"]
plansarrayA pricing table's plans: id, name, description, prices (amount and unit), features and recommended. Empty for pages
createdintegerWhen it was created, in Unix seconds
updatedintegerWhen it last changed, in Unix seconds
A checkout
{
  "id": "chk_Mg7tR2vX9kQp4WnZc8Lb",
  "object": "checkout",
  "kind": "page",
  "slug": "mug4k7tq2z",
  "url": "https://pay.railbed.io/c/mug4k7tq2z",
  "livemode": false,
  "active": true,
  "name": "Ceramic mug",
  "description": "Hand-thrown, 350 ml.",
  "amount": "18.00",
  "currency": "USD",
  "success_url": "https://mugs.example/thanks",
  "theme": "light",
  "button_label": null,
  "crypto": true,
  "routing": {
    "choice": "smart",
    "provider": null,
    "fallback": true
  },
  "collect": null,
  "options": null,
  "plans": [],
  "created": 1790380525,
  "updated": 1790380525
}
200 OK

Create a checkout

POST/v1/checkouts

Creates a checkout page in the key's mode, with the settings a new checkout starts with in the dashboard unless you send others.

ParameterTypeDescription
namestring RequiredShown to buyers, up to 80 characters
amountstring RequiredA decimal string from "1.00" to "100000.00", at most two decimals
currencystring RequiredUSD, EUR, GBP, CAD or AUD, in any letter case
descriptionstringUp to 280 characters
success_urlstringWhere buyers land once paid. Live mode needs https://
kindstringpage, the only kind the API creates for now
themestringlight (default) or dark
button_labelstringThe pay button's text, up to 32 characters
cryptobooleanDefault true: buyers may pay in crypto when it's on for the account
routingobjectDefault { "choice": "smart" }. For one provider: { "choice": "fixed", "provider": "stripe", "fallback": true }
collectobjectWhat the page asks buyers for besides their email, as on a checkout session
curl https://pay.railbed.io/v1/checkouts \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Ceramic mug",
    "description": "Hand-thrown, 350 ml.",
    "amount": "18.00",
    "currency": "USD",
    "success_url": "https://mugs.example/thanks"
  }'
Response
{
  "id": "chk_Mg7tR2vX9kQp4WnZc8Lb",
  "object": "checkout",
  "kind": "page",
  "slug": "mug4k7tq2z",
  "url": "https://pay.railbed.io/c/mug4k7tq2z",
  "livemode": false,
  "active": true,
  "name": "Ceramic mug",
  "description": "Hand-thrown, 350 ml.",
  "amount": "18.00",
  "currency": "USD",
  "success_url": "https://mugs.example/thanks",
  "theme": "light",
  "button_label": null,
  "crypto": true,
  "routing": {
    "choice": "smart",
    "provider": null,
    "fallback": true
  },
  "collect": null,
  "options": null,
  "plans": [],
  "created": 1790380525,
  "updated": 1790380525
}
201 Created

Put it on your site with the slug:

A buy button
<script src="https://pay.railbed.io/embed.js" async></script>
<railbed-button checkout="mug4k7tq2z"></railbed-button>

The checkout follows the dashboard editor's rules, and an error's field names the parameter you sent. This endpoint ignores Idempotency-Key: after a timeout, list your checkouts before creating another.

ErrorCause
400 invalid_kindkind is something other than page
400 missing_name, 400 too_longname is empty, or a text field is over its limit
400 invalid_description, 400 invalid_button_labelThat field isn't a string
400 invalid_amountamount isn't a decimal string from "1.00" to "100000.00"
400 invalid_currencycurrency isn't one of the five
400 invalid_urlsuccess_url isn't a full address, has a username or password, or isn't https:// in Live mode
400 invalid_theme, 400 invalid_valuetheme isn't light or dark, or crypto isn't a boolean
400 invalid_routingrouting names no choice, or a provider that can't take card payments
400 invalid_collectcollect asks for something it can't. field names the part
409 no_payout_walletLive mode, and the account has no payout wallet yet
409 commerce_pausedThe account has paused taking payments
403 integration_disabledCheckouts, or the API, are turned off for the account
403 merchant_read_onlyThe account is suspended or archived

Retrieve a checkout

GET/v1/checkouts/:id

Returns one of your checkouts in the key's mode, including one deleted in the dashboard (active: false). Another account's, or one in the other mode, is 404 not_found.

cURL
curl https://pay.railbed.io/v1/checkouts/chk_Mg7tR2vX9kQp4WnZc8Lb \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY"

List checkouts

GET/v1/checkouts

Returns your active checkouts of every kind in the key's mode, newest first.

ParameterTypeDescription
limitinteger1–100. Default 20
starting_afterstringA checkout id from the previous page's next_cursor
kindstringOnly page, pricing_table or widget
cURL
curl https://pay.railbed.io/v1/checkouts \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY"
Response
{
  "data": [
    {
      "id": "chk_Mg7tR2vX9kQp4WnZc8Lb",
      "object": "checkout",
      "kind": "page",
      "slug": "mug4k7tq2z",
      "url": "https://pay.railbed.io/c/mug4k7tq2z",
      "livemode": false,
      "active": true,
      "name": "Ceramic mug",
      "description": "Hand-thrown, 350 ml.",
      "amount": "18.00",
      "currency": "USD",
      "success_url": "https://mugs.example/thanks",
      "theme": "light",
      "button_label": null,
      "crypto": true,
      "routing": {
        "choice": "smart",
        "provider": null,
        "fallback": true
      },
      "collect": null,
      "options": null,
      "plans": [],
      "created": 1790380525,
      "updated": 1790380525
    }
  ],
  "has_more": false,
  "next_cursor": null
}
200 OK

Changing or deleting a checkout happens in the dashboard. A checkout whose price changes there keeps its slug, so buttons already on your site show the new price.

Access

Retrieving and listing need the payments:read scope, which Read only keys have. Creating needs checkouts:write, which Full access keys and agents with full access have.

Updated · This page as Markdown