Add Railbed to your website
Keep customers on your site while they choose what to buy. Copy a small HTML snippet; Railbed handles the checkout.
On this page
Choose the right format
A buy button opens a checkout over your website when clicked. A payment widget places a compact checkout directly inside your page. A pricing table can also sit inside your page with its plans visible. A widget or a table can open from a buy button instead; see On your page or in a pop-up.
These use checkouts created in the dashboard. Your website does not need an API key, a server integration or card fields.
| Format | Start with | What buyers see on your site |
|---|---|---|
| Buy button | Any checkout | A button; clicking opens the checkout in a pop-up over your page |
| Payment widget | A payment widget checkout | The compact checkout itself, inline |
| Pricing table | A pricing table checkout | Plans and the price switch, if configured |
Copy the code from Railbed
- Open Checkouts and select your saved checkout. It opens on its Share tab.
- Find Add it to your site. A checkout page gets a buy button. For a payment widget or pricing table, choose On your page or In a pop-up under How it shows on your site.
- For a button, optionally set its Button text (Buy now by default, or See plans for a pricing table) and Shape (Pill or Rounded). The preview shows the button as your page will.
- Copy the generated code and paste it into your site's HTML or custom-code block. You can paste a button as many times as you like.
- Preview the published page. Some site builders do not run custom scripts inside their editing canvas.
Start with a Test checkout and try it with Test on your site. When ready, copy code from a separate Live checkout and replace the Test snippet.
Under the code, For developers has the extras a developer can add: linking each payment to a user of your site, filling in the buyer's email, and matching your site's accent color, fonts and light or dark mode. The embedded checkout guide has recipes for WordPress, Webflow, Next.js and Vue, including React and Vue components.
On your page or in a pop-up
A payment widget or pricing table sits on your page unless you choose a pop-up, since that's what they're made for. Add it to your site shows both, with the trade-offs:
| On your page (the default) | In a pop-up | |
|---|---|---|
| What buyers see | The checkout or the plans, right in your page | A button that opens the checkout over your page |
| Best for | A page that sells one thing, or a pricing page | Pages with other content, several buy buttons or little room |
| Keep in mind | It takes room: a widget up to 440 pixels wide, a table the width it's given | Buyers click once before they see the price or the plans |
Either way, card details go in on the provider's page in a new tab, and a confirmed payment sends the buyer to your success URL if you set one. Nothing about the choice is saved with the checkout, so to change it, paste the other code.
Add a buy button
Include the script once per page, then put the button where you want it:
<script src="https://pay.railbed.io/embed.js" async></script>
<railbed-button
checkout="your-checkout-slug"
label="Book a consultation"
shape="rounded">
<a href="https://pay.railbed.io/c/your-checkout-slug">Book a consultation</a>
</railbed-button>The link inside the element is what shows if your site strips or blocks the script, so buyers can still reach the checkout. The script draws the button over it once it runs. The code you copy from the Share tab includes it.
| Attribute | What it does |
|---|---|
| checkout | Required. The slug from your saved checkout URL |
| label | Optional. Your button text; defaults to Buy now, or See plans for a pricing table |
| shape | Optional. Use pill or rounded; the default is pill |
The button takes the checkout's accent color: the one set for the checkout's look, or else your business's brand color from Settings. The button label is separate from the payment button text inside the checkout.
Add an inline checkout
For a payment widget or pricing table, use this element:
<script src="https://pay.railbed.io/embed.js" async></script>
<railbed-checkout
checkout="your-widget-slug">
<a href="https://pay.railbed.io/c/your-widget-slug">Buy now</a>
</railbed-checkout>The embedded checkout adjusts its height to its content as the buyer moves through it, and takes the look you set for the checkout. Give it enough width for the checkout to be readable; test the surrounding layout on a phone too.
Match your site's look
The checkout uses the accent color and fonts set for it in the dashboard, inside Railbed's own design. A developer can also match it to your site with a few lines of CSS, which win over the dashboard's settings on that site:
<style>
railbed-checkout,
railbed-button {
--railbed-accent: #1F4D3A;
--railbed-font: Inter;
}
</style>Text stays readable whatever accent is set. Every variable is listed in Match your site.
What happens when a buyer pays
The buyer starts in your embedded checkout. The card provider opens in a new tab because card entry happens on the provider's own page. If the browser blocks the new tab, the provider opens in the same tab instead. If your site doesn't let the checkout open the provider at all, the buyer is offered the checkout in a new tab, and the Share tab tells you (troubleshooting).
If the buyer comes back to your page before their payment arrives, the checkout asks whether they finished paying and offers Choose another way to pay first (what the buyer sees). After confirmation, the buyer sees a receipt in the checkout, and then your page goes to the success URL you configured, if there is one. If a buyer tries to close a pop-up while their payment is open in the other tab, it asks Close checkout? with Keep paying and Close. On phones, a pop-up fills the screen. Returning to your website alone does not confirm payment: check Payments or use your connected store's verified order status.
Test on your site
A Test checkout takes payments only from your team, on your website too: anyone else sees that it's a test and can't pay. To try it where you pasted the code:
- In Test mode, open the checkout's Share tab. Owners, managers and developers see this section.
- Under Test on your site, enter the address of your page, then choose Get test link.
- Open the link. For one hour, the tab it opens in can try Test payments on your page.
Anyone with the link can try Test payments there until it runs out, so share it only with your team. Test payments never take real money.
Without the link, a Test checkout on your site shows This checkout isn’t live yet and “[your business] is still setting it up, so nothing can be paid here yet.”, to your team too. If the hour runs out while the checkout is open, the next Pay shows the same card; get a new test link to carry on.
Troubleshoot an embed
- Nothing appears: confirm your site builder allows custom HTML and JavaScript, includes the script, and keeps the custom element tags. Check the published page as well as the editor.
- Blocked by your site's security settings: if your site sets a Content Security Policy, allow
https://pay.railbed.ioin itsscript-src,frame-srcandconnect-srcrules. When a site's policy blocks an embed, the checkout's Share tab names the site and when it last happened. - Buyers can't reach the card provider: some sites stop embedded content from opening new tabs. Buyers then see This site can’t open the card provider from here with a link to open the checkout in a new tab, and the Share tab names the site. Link to the checkout's own page there instead, or ask whoever runs the site to let frames from
pay.railbed.ioopen tabs. - Checkout unavailable: check that the slug matches an existing checkout and that it has not been deleted or become unavailable.
- Still in Test mode: copy the code from the Live checkout. Flipping your dashboard mode does not change the slug in your website. A Test checkout shows your buyers This checkout isn’t live yet and can't be paid; to try it yourself, use Test on your site.
- Provider opens elsewhere: that is expected. Provider card entry is not embedded inside your website.
Only Railbed checkout and payment pages can be framed. Do not try to embed the dashboard or a tracking page. If a custom integration needs more control, use the embedded checkout guide.