Skip to main content

Checkout in plain HTML

Time: ~15 minutes | Difficulty: Beginner | Type: part of Examples
Finished project: headless-vanilla. Clone it if you want the working funnel first — or keep reading and rebuild the three pages yourself.
Proof that the Headless SDK needs zero tooling: three static HTML files, the SDK from a CDN, and you get a real store — catalog, cart, card payment with automatic 3DS, and one-click post-purchase upsells. If you can host a folder, you can host this.

Setup — two lines to edit

No .env, no build. Provision a demo store from the terminal, then paste your store id:
Serve the folder with anything (npx serve, nginx, S3, a USB stick) and open index.html.
The SDK ships as an IIFE bundle on jsDelivr — window.TagadaHeadless appears after one <script> tag. TagadaHeadless.create({ storeId, environment }) gives you the same client as the npm package.

Page 1 — cart to checkout in one call

The home page lists real products from your catalog and keeps the cart in localStorage. Checkout is a single call — createSessionUrl creates the session and builds the URL to send the customer to:

Page 2 — the checkout

checkout.html starts with the two lines that make redirects painless. If the customer is coming back from a 3DS challenge or a processor redirect, maybeResumeFromUrl() polls the payment to a terminal state and hands you the result; otherwise it returns null and the page renders normally:
Then the normal path — read the tokens, load the session, and on submit: save the customer, pick a shipping rate, tokenize, charge:
tokenizeCard() talks to Basis Theory directly from the browser — raw card data never touches your server, which keeps you out of PCI scope. If processPayment returns requires_redirect, navigate to result.redirectUrl (the example shows the POST-form variant too) and maybeResumeFromUrl() finishes the job when the customer comes back.

Page 3 — one-click upsells

The thank-you page lists upsell offers and charges the saved card in one click — a MIT charge, no card form the second time:
Same funnel shape as the funnel demos — this is just the smallest possible implementation of it.

Next

Finished project on GitHub

Three HTML files, ready to serve — edit config.js and open

Same thing in React

headless-react-store — the fork-ready boutique storefront

Checkout flow reference

Sessions, addresses, shipping rates, promo codes

Offers reference

listOffers, previewOffer, processOfferPayment