RailbedDocs

Payment links and buy buttons

Take payments without writing server code. Create payment links, checkout pages and pricing tables in the dashboard, and add a buy button or an embedded checkout to any website with two lines of HTML.

What you can make in the dashboard

Everything here is created under Create in the dashboard, in Test or Live mode. Each one produces a Railbed-hosted page, and every payment appears in Payments and sends your webhooks, exactly like an API payment.

KindWhat it isAddress
Payment linkOne payment for one payer: an invoice or a deposit, with an optional note, reference and expiry (1–30 days). Comes with a read-only tracking link you can sharehttps://pay.railbed.io/p/pay_…
Checkout pageOne product at one price that any number of buyers can payhttps://pay.railbed.io/c/your-slug
Pricing tablePlans side by side, with an optional monthly/yearly switch. The buyer picks a plan, then payshttps://pay.railbed.io/c/your-slug
Payment widgetThe checkout itself in a compact card, made to sit inside your pagehttps://pay.railbed.io/c/your-slug

Every checkout has a success URL (where buyers go once paid, with {PAYMENT_ID} filled in; checkout payments carry no reference, so {REFERENCE} is empty) and a light or dark theme. Checkout pages and widgets also take the button's text.

Add a buy button to any site

Paste the script once, anywhere in the page, then place a button wherever you want one. checkout is the slug at the end of the checkout's address.

A buy button that opens the checkout over your page
<script src="https://pay.railbed.io/embed.js" async></script>

<railbed-button checkout="your-slug"></railbed-button>

The button takes your brand colour, and screen readers hear the product and its price. Two attributes change it:

AttributeValuesDefault
checkoutThe checkout's slugRequired
labelThe button text, for example Get the notes"Buy now" ("See plans" for a pricing table)
shapepill or roundedpill

If the checkout is deleted or can't take payments, the button reads "Checkout unavailable" and is disabled.

Clicking opens the checkout in a dialog over your page. The buyer pays on the provider's page in a new tab; once the payment is confirmed, your page goes to the checkout's success URL. If the buyer tries to close the dialog while paying, it asks first.

Put the checkout in your page

For a payment widget or a pricing table, place the checkout itself in your layout:

The checkout, in your page
<script src="https://pay.railbed.io/embed.js" async></script>

<railbed-checkout checkout="your-slug"></railbed-checkout>

It sizes itself to its content and keeps its theme. Card providers never open inside the frame: they open in a new tab or, if the browser blocks that, in place of your page.

Good to know

  • The script has no dependencies, sets no cookies and stores nothing in the buyer's browser. It's plain JavaScript that works in current browsers; older ones show nothing rather than a broken button.
  • Your page needs no Railbed key: the button only knows the public checkout slug.
  • Only /c/ and /p/ pages can be embedded; the dashboard and tracking pages can't be framed.
  • Delete a checkout in the dashboard to stop new payments. Past payments stay.
  • Fulfil from webhooks, as with every integration: payments from buttons carry the checkout's id (checkoutId) and, for pricing tables, the chosen plan (planLabel).

Updated · This page as Markdown