Hosted page, embedded checkout or your own UI: which fits when the card is entered on a provider's page?
Who draws each screen in a hosted page, an embedded checkout and your own UI, a decision table, the code each needs for a $22 order, and what stays the same in all three.
Press the card to run an example sale.
When the card is typed on the provider's page, a hosted page, an embedded checkout and your own UI differ only in the screens around it. Use the hosted page for the least code, the embed to keep buyers on your site, and your own UI inside an app.
This guide is for developers integrating a checkout where an independent on-ramp provider charges the card, as on Railbed. It covers who draws each screen, a decision table, the code for a $22.00 order in each option, and what never changes.
Why the usual comparison doesn't apply here
Most comparisons of hosted, embedded and custom checkout are about where the card form sits. Stripe's overview offers a "full page" ("Embed or redirect to a prebuilt payment page on your website"), an "embedded form" ("Embed a prebuilt payment form on your website") and Elements, used "to design a custom page to collect payments". The further down that list you go, the closer the card fields come to your own code.
Card-security rules follow the same line. The PCI Security Standards Council's FAQ 1588 (February 2025) says a script-protection criterion in SAQ A "only applies to e-commerce merchants with a webpage that includes a TPSP's/payment processor's embedded payment page/form (for example, one or more inline frame(s) (iframes))", and "does not apply" to sites that redirect customers to the processor. So with a card processor, embedding the form brings an eligibility check that a redirect doesn't.
An on-ramp checkout takes the card fields out of that comparison. On Railbed, "Card details are always entered on the provider's own page, never on Railbed's pages or yours, so your integration stays out of card-data scope," as the docs home puts it. That holds in all three options. Railbed makes no statement about your own PCI obligations; if a bank or partner asks you for a questionnaire, check with them which one applies.
What's left to choose is effort, how much of the journey you design, and where the buyer waits while the provider's tab is open.
Who draws each screen
Follow one purchase through its five screens and note whose code draws each one.
| Screen | Hosted page | Embedded checkout | Your own UI |
|---|---|---|---|
| Product and price | You | You | You |
| Email and details | Railbed's page | Railbed, inside your page | You |
| Choosing a card provider | Railbed's page | Railbed, inside your page | You, from the API's list |
| Card entry | Provider's page, new tab | Provider's page, new tab | Provider's page, new tab |
| Waiting and result | Railbed's tab, then your success_url |
Railbed, inside your page | You, polling your server |
Only the fourth row never changes, which is why the decision is about the other four.
The decision table
The table compares the options on what a developer weighs first. Every row comes from Railbed's guides for hosted checkout, embedded checkout and your own checkout.
| Hosted page | Embedded checkout | Your own UI | |
|---|---|---|---|
| Code you write | Server: create a session, redirect | A script tag and an element; optional server endpoint | Server: create and start a session; your screen; a status check |
| API key in the page | No | No | No (your server calls the API) |
| Buyer leaves your site | Yes, until success_url |
No | No |
| Design control | Logo, accent, fonts, light or dark | Accent, fonts, light or dark through CSS variables | All of it, except the provider's page |
| Works in a mobile app | Yes | A web page only | If your app opens each link in the device's browser |
| Knows which of your users paid | Yes: your reference and metadata on the session |
With an "Ask at Continue" endpoint | Yes: your session |
| Best for | Stores, server-rendered apps, first integrations | Marketing sites, pricing pages, site builders | In-game stores, app upgrade screens |
Option 1: the hosted page
The hosted page is a checkout session your server creates for each order and redirects the buyer to. Railbed's page asks for the email, shows the providers that can take the payment with the recommended one first, and opens the chosen one in a new tab; the checkout tab waits, then sends the buyer to your success_url.
The server side for a $22.00 order is one request, sent with an Idempotency-Key saved alongside the order so a retry returns the same session:
curl https://pay.railbed.io/v1/checkout_sessions \
-H "Authorization: Bearer $RAILBED_SECRET_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_1042" \
-d '{
"amount": "22.00",
"currency": "USD",
"description": "Order 1042",
"reference": "order_1042",
"success_url": "https://yourstore.com/orders/1042/thanks?payment={PAYMENT_ID}",
"cancel_url": "https://yourstore.com/cart"
}'
Redirect the buyer to the url in the response. A session lasts 24 hours, or 2 hours after the buyer last went to a provider if that is later.
The hosted page has a halfway variant: Railbed.open(url) from https://pay.railbed.io/embed.js opens the same session in a pop-up over your page. The guide is plain about the trade: the default redirect "needs only server code and works in every browser and app", while the pop-up is for websites and web apps; in a mobile app, the guide's table says, the app "opens the url in the browser instead".
Choose the hosted page when you want the smallest integration that works everywhere, or when your product is a mobile app.
Option 2: the embedded checkout
The embedded checkout runs a checkout you made in the dashboard inside your own page. <railbed-checkout> draws the checkout in the page and <railbed-button> opens it over the page (a full-screen sheet on phones):
<script src="https://pay.railbed.io/embed.js" async></script>
<railbed-checkout checkout="your-checkout-slug">
<a href="https://pay.railbed.io/c/your-checkout-slug">Buy now</a>
</railbed-checkout>
The link inside is what buyers see if the script is blocked. "No API key goes in the page," site builders such as WordPress or Webflow take the snippet in a custom-code block, and a widget is up to 440 pixels wide.
Three details matter to developers:
- Knowing which user paid. Give the element a
session-endpoint. When the buyer presses Continue, the page posts to that path on your site with your cookies, your server creates a session from the checkout for its signed-in user, and answers{ "session": "pay_…" }within 15 seconds. - Matching your site.
--railbed-accent,--railbed-font,--railbed-heading-fontand--railbed-modeset the accent color, fonts and theme. The layout, other colors and corners stay as Railbed designs them. - Events are hints.
railbed:paid,railbed:handoffand the rest let your page react, but the guide states that "An event is a signal for your page, not proof of payment."
If your site sends a Content Security Policy, allow https://pay.railbed.io in script-src, frame-src and connect-src. React and Vue components come in the @railbed/embed package.
Choose the embed when buyers should never leave your page and you are happy with Railbed's checkout design in your colors and fonts.
Option 3: your own UI
Your own UI keeps every screen except the provider's page. Your server creates the session as for the hosted page, then starts it with the buyer's email and, if known, country; the response lists the providers, each with a handoff_url. Shortened to one provider and the fields that matter here:
{
"id": "pay_7AAiYH0Ykt11ED4hmfiN",
"country": "US",
"providers": [
{
"id": "stripe",
"name": "Stripe",
"note": "Card, Apple Pay or Google Pay",
"recommended": true,
"handoff_url": "https://pay.railbed.io/go/pay_7AAiYH0Ykt11ED4hmfiN?provider=stripe"
}
]
}
A real response also repeats the session's own fields and lists every provider that can take the payment, with the recommended one marked. Draw them as a list, cards or a menu, and when the buyer picks one, open its handoff_url in a new tab from the click itself.
That "from the click" rule is a browser rule, not a Railbed one. MDN's entry on transient activation explains that scripts "cannot arbitrarily launch a popup that requires transient activation" and that it "must be triggered from a UI element's event handler." A tab opened after an await on your server may be blocked.
Two things your UI must not do. Railbed's guide says: "Don't fetch a handoff_url from your server, frame it in an iframe or change its query. It must open in the buyer's own browser: providers check the buyer's real location and refuse to load inside frames." Sites refuse framing with headers such as the frame-ancestors directive, which "specifies valid parents that may embed a page". Then, because providers don't send buyers back, your screen asks your own server every few seconds and your server answers from the webhook or GET /v1/payments/:id.
Steps 1 and 4 run on your server; only step 3 leaves your design.
GET /v1/payment_methods previews the providers without starting anything. They change with amount, currency and country, so fetch them when the buyer reaches your checkout screen instead of caching them.
Choose your own UI when the purchase belongs inside your product, such as an in-game store or an upgrade screen, and you have the server code to run it.
What stays the same in all three
Some behavior belongs to the provider hand-off, not to the integration you choose, so plan for it whichever option you pick:
- Two tabs. The provider opens in a new tab and Railbed's tab (or your screen) waits. When a browser can't open one, as in some apps' built-in browsers, the provider opens in the same tab instead (why there are two tabs).
- No return from the provider. Providers don't send buyers back on their own, and a buyer can open a
success_urlwithout paying. Treat the return page as a status screen. - Fulfill from your server. Grant the order on the verified
payment.paidwebhook or aGET /v1/payments/:idcheck (fulfill orders safely). - The same provider list. Smart Routing weighs the buyer's country, the currency, the amount, each provider's minimum and whether the provider is working today. A card can still be declined on the provider's page, and the provider decides whether to check identity.
- The same minimums. The smallest card payment is about 2.00 USD, set by the providers; an amount under every provider's minimum is refused when the session is created. Prices of about $10 or more give buyers the widest choice.
- One exception. Venmo, for US buyers, is paid from the Venmo app with details shown on Railbed's own page, so no provider tab opens.
When a different tool is the better answer
All three options assume the buyer pays on a provider's page in another tab. If your design needs the card form inside your own page, an embedded form from a card processor is the tool, provided a processor will take your business. If you have no website or server at all, an invoice or payment link shared by URL or QR code needs no integration. And if you sell through a Shopify store, the external checkout article covers that route instead.
Railbed's options fit when processors have turned your business away or you want sales to settle to a wallet you control, almost always as USDC. They don't fit if the money must land in a bank account with no step of your own, since cashing out goes through an exchange or wallet app.
FAQ
Do I need a server for each option? The embedded checkout and buy button work without one, from a checkout made in the dashboard. The hosted page and your own UI need server code, because sessions are created with a secret key and Railbed has no publishable key for browsers.
Can I use more than one option on the same site?
Yes. A pricing page can embed a checkout while your app's upgrade screen uses its own UI, and both report to the same webhook endpoints, with the checkout named on each payment.paid event that came from one.
Can I test each option without real money? Yes. Test mode runs every option with simulated payments; a Test checkout embedded on your own site needs a one-hour test link from the checkout's Share tab. Its provider list is fixed, so it doesn't show which providers will approve a real buyer.
Try all three options in Test mode
Create a $22 Test checkout, embed it on a page, then open the same order as a hosted session and through the start call, with no real money moving.
Create an accountRead the checkout guides