---
title: "Checkout session API vs hosted buy buttons: which should your app use?"
description: "Decide whether your app needs an order-specific checkout session or a hosted buy button, and plan a safe move from one to the other."
url: "https://railbed.com/insights/checkout-session-api-vs-hosted-buy-buttons/"
markdown: "https://railbed.com/insights/checkout-session-api-vs-hosted-buy-buttons/?format=md"
published: "2026-12-04"
author: "Railbed"
publisher: "Railbed, LLC"
section: "Insights"
reading_time: "12 min"
language: "en"
---

# Checkout session API vs hosted buy buttons: which should your app use?

> Keep the hosted buy button for fixed-price offers. Create checkout from your own server when every sale needs a confirmed cart, order or account.

Source: https://railbed.com/insights/checkout-session-api-vs-hosted-buy-buttons/ · Published: 2026-12-04 · 12 min read · Railbed, LLC

For AI assistants: the company overview is https://railbed.com/llms.txt, and the developer docs index, with the rules for an integration, is https://railbed.com/docs/llms.txt

Use a hosted buy button when one product has one published price and your team can identify each purchase from the resulting payment record. Use a checkout session API when your app must calculate the final amount or associate payment with an exact order, cart or customer workspace before the buyer pays. Your customers can still finish card payment on a hosted page in either design. The difference is whose system owns the terms of the sale before the handoff.

## The decision starts with the order

A buy button can represent a concrete offer. Think of a bakery taking orders for a fixed-price class, a studio selling one downloadable course, or a business offering a standard introductory consultation. One saved product page can serve many customers. The button on the website brings a buyer to a payment flow configured for that product. The product, rather than the buyer's shopping cart, sets the amount. Buyers get separate payments; the shared address is not a shared payment.

An order-specific session represents a particular checkout prepared by your application. The application reads the signed-in account or cart, confirms what can be sold and calculates the final amount. It saves those facts and sends the buyer to pay for that order. This is useful when two people looking at the same product could legitimately owe different amounts, or when payment must unlock access in a workspace your app controls. Without the link to the original order, the team has to infer which customer or cart paid from less reliable clues.

| If the sale depends on | Start here | Main responsibility |
| --- | --- | --- |
| The same offer and set price for every buyer | Hosted buy button | Keep the published offer, buyer details and fulfillment practice current |
| A changing cart, negotiated amount or delivery quote | Order-specific session | Calculate and save the final amount before the buyer continues |
| A signed-in account that receives licensed access | Order-specific session | Bind the payment to the correct account and grant access once |
| One previously agreed invoice or deposit | A specific payment request may be simpler | Keep the quote, request and outstanding balance linked |

The table is about order authority, not how prominent you want the payment action to look. A visually custom Button can still lead to hosted checkout. Conversely, a checkout created from your backend can still use a conventional, provider-hosted buyer experience. For a comparison of where the interface itself lives, see [hosted page, embedded checkout or your own interface](https://railbed.com/insights/hosted-page-embedded-checkout-or-your-own-ui/).

## When the hosted button is the better choice

Start with Railbed's [reusable checkout pages](https://railbed.com/docs/user-guide/checkout-pages/) if the buyer is purchasing a defined offer at a fixed price and the simplest delivery process is good enough. The page can gather configured buyer details. Use the brand and product name people recognize from where they clicked. A button that says “Book the Saturday class” should not land on a purchase described only as “Services.” The less clearly the two screens match, the harder it is for a buyer to know whether they are paying the right business for the right thing.

Consider a merchant that sells one recorded workshop for everyone at the same price. A buyer can find that offer in a newsletter, an assistant's recommendation or a landing page. A single hosted checkout can serve all those visitors without your team maintaining parallel payment products. If the shop delivers a download manually, the team can check each payment before sending the program. If access must be assigned to one preexisting workspace in an app, however, you need a documented way to identify that workspace. The person's payment email alone does not prove account ownership. At that point, simplicity on the buy-page side may be turning into manual support work.

Review what comes back from the hosted path before designing delivery. Railbed's docs say reusable checkout does not supply your custom order reference in the return field. If your business already creates an order at the start of the purchase, and that exact identifier must make it all the way through confirmation, consider the session route. A required customer question can collect useful fulfillment information, but don't use buyer-entered answers as proof that a paid purchase belongs to a privileged account. A typed workspace identifier is not the same thing as a workspace resolved by your own application from the signed-in order.

Price changes deserve a handover rule even on a simple button. Railbed documents that edits to a reusable page keep its shared address, while payments already created keep their saved amount and description. A person already viewing checkout can be prompted to review the new price before proceeding. Check your landing page, assistant recommendations and sales materials whenever you change the price. Keep the old order record intact so the team can see what the customer actually agreed to, rather than deciding every earlier buyer was offered today's total. The [repeat-sales checkout guide](https://railbed.com/insights/reusable-checkout-page-to-repeat-sales-complete-workflow/) covers operating the reusable flow after launch.

## When a session is worth the extra work

Create a session from your app when it is already responsible for deciding what the customer can buy. A single cart might include an item with low stock, a shipping charge tied to the address, an approved discount and an eligibility rule for a particular destination. Those conditions exist before the buyer reaches payment. A coding assistant can help put them in one flow, but it should not quote whatever total it last saw in a chat message or calculate a shipping price from memory. Let your store's pricing and inventory records decide.

In the [Railbed fulfillment documentation](https://railbed.com/docs/guides/fulfilment/), the store saves the important order facts before creating the session, then stores the returned payment identifier. Save which customer or workspace is purchasing, the items and amounts, the currency and the reference your team will use to match the order later. If a creation call times out without giving your app a usable result, preserve that attempt and follow the documented retry rules. Railbed documents reusing the same request key for a retry of the same creation request. This is not permission to reuse that key when your store has changed the order terms.

That distinction matters when a shopper clicks twice. Two clicks on the same unchanged order do not create two purchases. A buyer deliberately changing quantity before agreeing to a different total is different. Your app should acknowledge the change, show the revised terms and keep track of which payment attempt was tied to which version of the order. If an older payment can still arrive, staff need to see the earlier terms. Do not replace them in the history with the newer basket, then use the newer basket to ship automatically.

A session also gives you a way to support orders that leave the browser before confirmation. A buyer may switch to a banking app, close the tab or return directly to a signed-in order history. The buyer-facing screen can say payment is pending while your server checks the authoritative state. It does not need the original page to grant an entitlement. This helps a customer who paid on a phone but returns on a laptop. It also gives support a place to look without asking the buyer to keep reopening their card page.

## Example: moving one store from a button to sessions

Suppose an ordinary stationery shop sells a fixed-price boxed set through a hosted buy button. The product goes to the warehouse with a delivery address and is shipped after staff verify payment. This works until the shop adds optional refills, regional delivery rates and an account-based wholesale discount. At that point a customer can click the same product page, but the amount they owe depends on three facts the old offer was not designed to represent. Raising or lowering the price on the fixed-payment page for every buyer is no longer a workable response.

The store keeps the original boxed-set page for the existing offer and tests an order-specific path only for the variable bundle. The store calculates the final bundle total and creates the order before opening payment. The buyer sees the quantity, destination and final approved amount. After payment the store checks the provider record against this order, then releases the bundle. The warehouse can see which products were supposed to arrive even if an old item description on the website changed. If fulfillment fails, the store can recover the shipment from its paid order instead of sending the buyer back to checkout.

Now suppose a shopper opens the bundle, applies a discount and pays later after a staff member has already saved a replacement with another price. Handle this as an exception, not a reason to send either basket on sight. Establish which payment arrived and which version it covered. Identify whether the old order can still be honored, whether an outstanding balance or refund needs review and what the store owes the buyer under the original terms. Do not let a newer total appear to be the payment evidence for the earlier basket. This is a reason to preserve versioned order records, not a reason to ask the buyer for sensitive proof.

If the shop needs to stop the session pilot, it should stop presenting the new path to new customers while keeping its order status and support views available. It should not remove evidence of sessions already underway. The original fixed-price path is still suitable for the original product, but isn't a substitute for a variable order whose payment state nobody has checked. Give staff the names of both paths and tell them which one can answer questions about each set of orders.

## Decide who can do what with an AI tool

Give a coding assistant a brief that describes the offer, order source, payment handoff and delivery rule. A button change might require a frontend edit and a walk through the buyer screen. A session integration requires saving the order, creating checkout under the correct business and environment, checking payment and delivering exactly once. Ask the assistant to document the actual behavior it tested and where the buyer-facing screen stops making promises. The assistant should not need live access or wallet authority to prove the integration in Test.

Railbed maintains [checkouts.md](https://checkouts.md/), the open format for documenting merchant checkout. Use it to identify price authority, how payments match orders, which code releases the purchase and what evidence exists. The project record does not authorize delegated buyer spending. It also is not a place to paste secret values, verification codes or private details. The next person should be able to find the authorized way to test checkout without inheriting production credentials from the previous setup. See [the guide to documenting payments for AI agents](https://railbed.com/insights/how-do-you-use-checkouts-md-to-document-payments-for-ai-agents/) for how to leave a usable project record.

In a separate operations workflow, give an assistant only the permissions it needs. Reading an order's verified status is not the same as preparing an invoice or proposing a change to a product. Moving money, deciding a refund and modifying the payout destination are not consequences that should follow from a chat reply. Even a useful internal assistant can misunderstand which business or order a person is talking about. Keep the business and environment visible in the workflow and direct uncertain cases to a person rather than switching context on a guess.

## Confirm the payment and deliver the expected order

The return page is a convenience, not payment proof. Match the provider-confirmed payment identifier, reference, amount, currency and environment to the expected order before delivering what it bought. In the checkouts.md workflow, verify the signed notification and check the provider's payment record before fulfilling. Railbed also documents authenticated retrieval to recover missed notifications. Preserve the distinction between a held payment, a confirmed payment and confirmed payment with delayed delivery. See the [payment notification verification guide](https://railbed.com/insights/how-do-you-verify-an-agentic-checkout-payment-webhook-before-delivery/) for how to design the confirmation boundary.

Before expanding, rehearse a specific delivery breakdown. A customer buys one digital license for a team, but the entitlement service is unavailable when payment is confirmed. The order stays paid and the delivery stays outstanding. When the application recovers, it issues the promised license once for the original team. A support assistant can say what is pending. It should not send another payment link. For physical goods, use the order reference to prevent duplicate shipping even if more than one payment attempt reports a result. A confirmed overpayment belongs in a human review queue, not on the packing line as a duplicate shipment.

Keep fixes proportional to what failed. If a buyer cannot find the payment screen, review the button label and handoff. If several cart prices are wrong, investigate the pricing source and order snapshot. If confirmed orders do not reach the warehouse, investigate fulfillment without changing checkout prices or refunding everything. Keep a short list of which records prove each stage. That way a developer can repair the part that broke and customer support can tell the buyer what is known without inventing a payment decision.

## Run a buyer and finance pilot on both routes

In Railbed's card checkout, buyers enter their card details on the provider's page. Buyer ID checks depend on the provider. A custom session doesn't allow the app to skip those checks, and a hosted buy button doesn't guarantee that any card will complete a payment. In Test, verify the amounts, order references, success and nonpayment paths. In a Live pilot with eligible orders, observe buy-page handoff, confirmed order completion and what finance actually receives. Start with one product path and expand only as staff can support it. For store examples, see [Railbed for ecommerce](https://railbed.com/industries/ecommerce/).

Have finance trace at least one confirmed order from each live path you intend to keep. Railbed never holds funds. Card sales settle to a wallet the merchant controls, almost always as USDC on Polygon. Settled sales can't be pulled back from your wallet. That does not eliminate obligations to resolve customer complaints, refunds or disputes. If you convert and withdraw, keep the wallet receipt and the final bank record as separate events. A developer can demonstrate that a session works without proving the business has arranged a compatible bank withdrawal.

For a high-risk merchant processing more than $50,000 a month, bring a representative fixed sale and the hardest eligible variable-cart sale to [Railbed sales](https://railbed.com/contact/). Explain what changes between those carts and how support can identify a paid order when a customer asks for help. Agree on which results you need to see before moving traffic. A test that never includes the product, device or market where customers struggle cannot settle whether the replacement fits the business.

## FAQ

**Is a hosted buy button the same thing as a checkout session API?**

No. A buy button usually opens a predefined product checkout. An order-specific session is created by your application from the facts of a particular purchase. Both can still send the buyer to hosted payment.

**What is the simplest option for a fixed-price product?**

A reusable hosted checkout is usually the simpler starting point if each payment can be reliably matched to its delivery. Add an order-specific flow when your application needs to supply the price or the exact account in advance.

**Why should I save the order before creating the payment session?**

The saved order states what the buyer is expected to pay and receive. It gives the store a reference for safe retries, payment checks and recovery if the session request or later delivery is interrupted.

**Can I use the payment email to grant access to an account?**

Do not treat it as proof of account ownership. Resolve the purchaser's account through the application and the order it created. A different person may pay, or the buyer might use a different email on the payment page.

**Does a custom session make buyer verification optional?**

No. Buyer ID checks depend on the provider. A custom merchant session changes how the store prepares the order, not who handles card entry or any required provider checks.

**Can I switch off the old button the moment I create a session?**

Only after you know which purchases should use the new route and how to handle old attempts. Turning off a route for new buyers does not by itself resolve already-started payments or earlier fulfilled orders.

**Should an AI agent decide what amount to charge?**

Your store or an approved invoice should determine the amount. The agent can help assemble a proposed order or build the connection, but the application should confirm the approved price before handing the buyer off to payment.

## The decision before launch

Keep the simple button where a product really is one product at one price. Use a session where your application must prove what a particular customer bought and at what amount. Only move the next offer when your team can find that payment, deliver the right order once, and trace the receipt without asking the buyer to explain what your checkout did.

## More from Insights

- [How to build a headless checkout for an AI-assisted storefront](https://railbed.com/insights/headless-checkout-for-an-ai-assisted-storefront/): Let the assistant build the basket. Keep price, inventory and delivery with the store. Use a verified payment record to connect the two.
- [How to add Railbed checkout to a Next.js app with an AI coding agent](https://railbed.com/insights/add-railbed-checkout-to-a-nextjs-app/): Use the Next.js recipe to connect your pricing page, saved order, hosted payment and delivery. Prove each handoff before deploying Live.
- [Hosted page, embedded checkout or your own UI: which fits when the card is entered on a provider's page?](https://railbed.com/insights/hosted-page-embedded-checkout-or-your-own-ui/): 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.
