Checkouts
Create reusable checkout pages and widgets from your own code, with their look, 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. To know which of your users paid a checkout, your server makes a session from it for that user.
| Field | Type | Description |
|---|---|---|
id | string | The checkout's id, chk_… |
object | string | "checkout" |
kind | string | page, pricing_table or widget. The API creates pages and widgets; pricing tables are made in the dashboard |
slug | string | What a buy button takes: <railbed-button checkout="mug4k7tq2z"> |
url | string | The hosted checkout page. Share it, or link to it |
livemode | boolean | false for Test mode, true for Live mode |
active | boolean | false once it was deleted in the dashboard, or while it's turned off there; either way it takes no new buyers. A turned-off checkout is still listed and can be turned on again in the dashboard |
name | string | Shown to buyers |
description | string or null | Shown under the name |
amount | string | The price. A pricing table's lowest plan price |
currency | string | USD, EUR, GBP, CAD, AUD, INR or SEK |
success_url | string or null | Where buyers land once paid |
theme | string | light or dark. With a background, the background's own shade; with appearance.theme set to auto, the theme it falls back to |
appearance | object | How it looks to buyers. See The appearance object |
button_label | string or null | The pay button's text, or null for "Continue to pay" and the price |
intro | string | A widget's first screen: form opens on the pay form (the default), offer on the product, its price and one button, which opens the form in the same card. Always form for pages and pricing tables |
crypto | boolean | Whether buyers may pay in crypto, when crypto payments are on for the account |
payment_methods | array | How customers pay: ["card", "crypto"] or ["card"] for a Card Checkout, ["crypto"] for a Crypto Checkout (crypto only, no card providers). See How customers pay |
routing | object | How 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) |
collect | object or null | What the page asks buyers for besides their email, or null for nothing more. See The collect field |
options | array or null | A pricing table's two-way switch, such as ["Monthly", "Yearly"] |
plans | array | A pricing table's plans: id, name, description, prices (amount and unit), features, recommended and cta (the words on its button, or null for "Choose" and its name). Empty for pages and widgets. A plan's id, with the side of options the buyer chose, is what a session from this checkout takes |
created | integer | When it was created, in Unix seconds |
updated | integer | When it last changed, in Unix seconds |
discord_access | object | Only when it gives roles in a Discord server: the server, the roles and how long access lasts. See Discord access |
warnings | array | On the create and update responses only, and only when there is something to say: what the card providers' minimums mean for the price. See Provider minimums |
{
"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",
"appearance": {
"theme": "light",
"use_brand": false,
"accent": null,
"background": null,
"corners": "soft",
"edge": "outline",
"font": null,
"heading_font": null,
"logo": true,
"header_image": null
},
"button_label": null,
"intro": "form",
"crypto": true,
"payment_methods": [
"card",
"crypto"
],
"routing": {
"choice": "smart",
"provider": null,
"fallback": true
},
"collect": null,
"options": null,
"plans": [],
"created": 1790380525,
"updated": 1790380525
}The appearance object
The checkout's own look, never the account's: a null colour or font means the account's or Railbed's. Railbed derives every other shade from these, keeps the text readable on any background, and keeps the layout.
| Field | Type | Description |
|---|---|---|
theme | string | light, dark, or auto to follow the buyer's device (falling back to the top-level theme). While background is set, the card is light or dark by the background's own shade, and theme reads as that |
use_brand | boolean | Whether it takes your account's brand (colour, fonts and logo, from Settings → Brand) under its own settings |
accent | string or null | The accent colour, #RRGGBB. null is the account's |
background | string or null | The card's colour, #RRGGBB, as you chose it. A colour too close to the text is moved just enough when it's drawn. null is Railbed's |
corners | string | sharp, soft (Railbed's), rounded or round: the card, its fields and its buttons |
edge | string | outline (Railbed's), shadow or none: the card's edge where it sits in your page |
font, heading_font | string or null | A Google Fonts family for the text and for headings, such as Inter or Newsreader, served from Railbed's own hosts. null is Railbed's |
logo | boolean | Whether your account's logo shows |
header_image | object or null | The picture at the top of the card, or null for none: url, then how it's framed: fit (cover fills the box, contain shows the whole picture), ratio (16:9, 2:1, 3:1 or 4:1), focus (x and y, whole percentages from 0 to 100), zoom (100 to 300, with cover), band (with contain: surface, accent or #RRGGBB) and alt (what it shows, up to 120 characters; "" when it's decorative). A picture added before framing existed reads with null framing until it's adjusted |
The picture itself is added, replaced and removed in the dashboard, which resizes it in your browser before it uploads; the API adjusts its framing.
{
"id": "chk_Wd3nK8pQ2vR7tYx4Hm9B",
"object": "checkout",
"kind": "widget",
"slug": "wdg7mq3k2x",
"url": "https://pay.railbed.io/c/wdg7mq3k2x",
"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",
"appearance": {
"theme": "light",
"use_brand": false,
"accent": null,
"background": "#FBF6EC",
"corners": "rounded",
"edge": "shadow",
"font": "Inter",
"heading_font": null,
"logo": true,
"header_image": null
},
"button_label": null,
"intro": "offer",
"crypto": true,
"payment_methods": [
"card",
"crypto"
],
"routing": {
"choice": "smart",
"provider": null,
"fallback": true
},
"collect": null,
"options": null,
"plans": [],
"created": 1790380525,
"updated": 1790380525
}Create a checkout
POST /v1/checkouts
Creates a checkout page or widget in the key's mode, with the settings a new checkout starts with in the dashboard unless you send others.
| Parameter | Type | Description |
|---|---|---|
name | string Required | Shown to buyers, up to 80 characters |
amount | string Required | A decimal string from "1.00" to "100000.00", at most two decimals, and at least the smallest card payment (about "2.00" USD): see Provider minimums |
currency | string Required | USD, EUR, GBP, CAD, AUD, INR or SEK, in any letter case |
description | string | Up to 280 characters |
success_url | string | Where buyers land once paid. Live mode needs a public https:// page on your own site |
kind | string | page (default) or widget, the card that sits in your own page. Pricing tables are made in the dashboard |
theme | string | light (default) or dark. The same as appearance.theme: send one or the other |
appearance | object | Any of the appearance fields except header_image: theme (also auto), use_brand, accent, background, corners, edge, font, heading_font and logo. Colours in any letter case; a font must be a Google Fonts family |
button_label | string | The pay button's text, up to 32 characters |
intro | string | Widgets only: form (default) or offer, to open on the price and one button |
crypto | boolean | Default true: buyers may pay in crypto when it's on for the account. Leave it out when you send payment_methods |
payment_methods | array | ["card", "crypto"] (the default), ["card"] or ["crypto"] for a Crypto Checkout, which needs crypto payments on. See How customers pay |
routing | object | Default { "choice": "smart" }. For one provider: { "choice": "fixed", "provider": "stripe", "fallback": true } |
collect | object | What the page asks buyers for besides their email, as on a checkout session. Leave it out and the page asks for the email alone; a checkout made in the dashboard asks for the buyer's name too, so send { "name": "required" } to match it |
discord_access | object | Roles in a Discord server each purchase gives. See Setting Discord access |
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"
}'const checkout = await fetch('https://pay.railbed.io/v1/checkouts', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RAILBED_SECRET_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Ceramic mug',
amount: '18.00',
currency: 'USD',
success_url: 'https://mugs.example/thanks',
}),
}).then((r) => r.json());
// checkout.slug goes in <railbed-button checkout="…">; checkout.url is the page.checkout = requests.post(
"https://pay.railbed.io/v1/checkouts",
headers={"Authorization": f"Bearer {os.environ['RAILBED_SECRET_KEY']}"},
json={
"name": "Ceramic mug",
"amount": "18.00",
"currency": "USD",
"success_url": "https://mugs.example/thanks",
},
timeout=15,
).json(){
"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",
"appearance": {
"theme": "light",
"use_brand": false,
"accent": null,
"background": null,
"corners": "soft",
"edge": "outline",
"font": null,
"heading_font": null,
"logo": true,
"header_image": null
},
"button_label": null,
"intro": "form",
"crypto": true,
"payment_methods": [
"card",
"crypto"
],
"routing": {
"choice": "smart",
"provider": null,
"fallback": true
},
"collect": null,
"options": null,
"plans": [],
"created": 1790380525,
"updated": 1790380525
}A widget with its own look, which opens on its price:
curl https://pay.railbed.io/v1/checkouts \
-H "Authorization: Bearer $RAILBED_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "widget",
"name": "Ceramic mug",
"amount": "18.00",
"currency": "USD",
"intro": "offer",
"appearance": { "background": "#FBF6EC", "corners": "rounded", "edge": "shadow", "font": "Inter" }
}'Put it on your site with the slug:
<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.
| Error | Cause |
|---|---|
400 invalid_kind | kind is something other than page or widget |
400 unknown_field | appearance has a field it doesn't take. The message names the nearest one |
400 missing_name, 400 too_long | name is empty, or a text field is over its limit |
400 invalid_description, 400 invalid_button_label | That field isn't a string |
400 invalid_amount | amount isn't a decimal string from "1.00" to "100000.00", or is under the smallest card payment (the message names it) |
400 invalid_currency | currency isn't USD, EUR, GBP, CAD, AUD, INR or SEK |
400 invalid_url | success_url isn't a full address, has a username or password, is a Railbed page, or in Live mode isn't a public https:// address (the message says which) |
400 invalid_theme, 400 invalid_value | theme isn't light or dark (or disagrees with appearance.theme), or crypto isn't a boolean |
400 invalid_appearance | appearance isn't an object, or a field in it isn't a value it takes. field names it, such as appearance.corners |
400 unknown_font | appearance.font or appearance.heading_font isn't a Google Fonts family |
400 invalid_intro | intro isn't form or offer, or was sent for a page |
409 no_header_image | appearance.header_image was sent: a new checkout has no picture yet. Add one in the dashboard, then adjust it |
400 invalid_routing | routing names no choice, or a provider that can't take card payments |
400 invalid_methods | payment_methods isn't a list of "card" and "crypto", or crypto disagrees with it |
409 crypto_off | payment_methods is ["crypto"] while crypto payments are off for the account |
400 invalid_collect | collect asks for something it can't. field names the part |
409 no_payout_wallet | Live mode, and the account has no payout wallet yet, or its payout wallet can't take live payments (the message says why) |
409 commerce_paused | The account has paused taking payments |
403 integration_disabled | Checkouts, or the API, are turned off for the account |
403 merchant_read_only | The 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 https://pay.railbed.io/v1/checkouts/chk_Mg7tR2vX9kQp4WnZc8Lb \
-H "Authorization: Bearer $RAILBED_SECRET_KEY"Update a checkout
PATCH /v1/checkouts/:id
Changes a saved checkout by the dashboard editor's rules, for any kind, and leaves the rest. It takes the parameters of Create a checkout except kind, plus active, and appearance.header_image to frame a picture added in the dashboard. A new price, currency or provider choice meets the same checks as a new checkout, and the checkout keeps its slug, so buttons already on your site show the change. In appearance, only the fields you send change, and null puts a colour or font back to the default and corners and edge back to Railbed's. A pricing table's plans and the header image itself are changed in the dashboard. Everything is checked before anything is saved.
| Parameter | Type | Description |
|---|---|---|
active | boolean | false turns it off, so buyers see it isn't available; true turns it back on. Turning it off on its own is never refused, so a checkout can always be stopped; turning it on, like any other change, needs the account to be taking payments |
appearance.header_image | object | The framing to change: any of fit, ratio, focus, zoom, band and alt, with the same values a read returns. A null field stays as it is, and url may be sent back only as it is, so a read object can be sent back whole. Its size always comes from the stored picture |
curl -X PATCH https://pay.railbed.io/v1/checkouts/chk_Mg7tR2vX9kQp4WnZc8Lb \
-H "Authorization: Bearer $RAILBED_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "amount": "20.00" }'curl -X PATCH https://pay.railbed.io/v1/checkouts/chk_Mg7tR2vX9kQp4WnZc8Lb \
-H "Authorization: Bearer $RAILBED_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "appearance": { "corners": "rounded", "header_image": { "focus": { "x": 42, "y": 56 }, "zoom": 130, "alt": "A ceramic mug on an oak shelf" } } }'The response is the checkout as changed, with warnings when there's something to say about the card providers' minimums.
| Error | Cause |
|---|---|
409 currency_locked | A buyer has paid, or gone to pay, from it, so its currency is fixed. Create a new checkout for another currency |
409 checkout_deleted | It was deleted in the dashboard. Create a new one |
400 invalid_amount | A pricing table's price, which comes from its plans |
400 invalid_appearance, 400 unknown_font, 400 invalid_intro | As on create; intro is refused for a page or pricing table |
400 invalid_header | A framing value is out of range, url isn't the checkout's own picture, or header_image is null while there is a picture (remove it in the dashboard). field names it, such as appearance.header_image.zoom |
409 no_header_image | appearance.header_image was sent, but the checkout has no picture, or its file is gone. Nothing changed |
409 header_image_changed | The picture was replaced in the dashboard while your request ran. Your other changes were saved; read the checkout and adjust the new picture |
409 commerce_paused, 403 integration_disabled | Anything but turning it off, while the account has paused payments or checkouts or the API are turned off for it |
List checkouts
GET /v1/checkouts
Returns your checkouts of every kind in the key's mode that aren't deleted (turned-off ones included, with active: false), newest first.
| Parameter | Type | Description |
|---|---|---|
limit | integer | 1–100. Default 20 |
starting_after | string | A checkout id from the previous page's next_cursor |
kind | string | Only page, pricing_table or widget |
curl https://pay.railbed.io/v1/checkouts \
-H "Authorization: Bearer $RAILBED_SECRET_KEY"{
"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",
"appearance": {
"theme": "light",
"use_brand": false,
"accent": null,
"background": null,
"corners": "soft",
"edge": "outline",
"font": null,
"heading_font": null,
"logo": true,
"header_image": null
},
"button_label": null,
"intro": "form",
"crypto": true,
"payment_methods": [
"card",
"crypto"
],
"routing": {
"choice": "smart",
"provider": null,
"fallback": true
},
"collect": null,
"options": null,
"plans": [],
"created": 1790380525,
"updated": 1790380525
}
],
"has_more": false,
"next_cursor": null
}Deleting a checkout happens in the dashboard. A checkout whose price changes 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 and updating need checkouts:write, which Full access keys and agents with full access have.