Guides
The checkout kit
A whole checkout as code you copy into your site and own, in our design, re-themed with a few variables.
The kit is the fastest way to a real checkout. It is code that lives in your repository, not an embed: React components for every step, and a small server of yours that holds the secret key. Nothing of ours runs on your page, there is no iframe, and the key never reaches a browser. You change it as you like.
the buyer's page → your server (holds the key) → RCMS Tickets (holds, orders, tickets)
your server → your payment processor → the card- Client: every step, built for a phone first (48 px targets, 17 px text, plain errors that say what to do): tickets, add-ons, code, details, payment, confirmation, and the hold's clock.
Checkoutis the whole flow,CheckoutSheetthe same in a dialog, anduseCheckoutis the flow as a hook if you want to draw your own steps. - Server: handlers on web-standard
RequestandResponse, with adapters for Next.js, Express and Firebase. They check the price again before any money moves, and never forward a field a page should not set. - Attribution and pixels: UTM tags and click ids kept for 90 days, first and last touch, and one helper for the Meta, GA4 and TikTok pixels that gives
Purchasethe order's event id. - My tickets: the confirmation links My tickets, and the storefront carries its address as
my_tickets_urlfor your footer or nav. - Abandoned checkouts: the hold carries the buyer's email; when it expires you are told, with a link that puts the same tickets back. The kit sends no email and names no mail vendor.
Install it#
The shortest way is to give an agent the prompt on the agents page. It fetches the manifest and follows it. By hand:
- Fetch the manifest, https://rcms-tickets-test.web.app/kit/manifest.json. It lists every file, its checksum, the install tool, a recipe for Next.js and for Vite, and the steps.
- Run the tool the manifest names from your project's root. It copies the files into
src/rcms-tickets/and writeskit.lock. - Apply your framework's recipe: it adds new files only (one server route that holds the key, one page with
<Checkout />) and says what to merge into files you already have. CallcaptureAttribution()once in your site's root, because the visitor lands somewhere other than checkout. - Check that the secret file is ignored by git (
git check-ignore .env.local), then setRCMS_TICKETS_KEY(a test key) andRCMS_TICKETS_EVENT, on the server only. - Typecheck, build, run it, and buy a ticket. In test mode the payment step has four buttons: Works, Declined, Not enough funds and Processor error. Press Works, then Pay. A button fills the card number (
4242 4242 4242 4242for Works), and the number in the box is what counts, so typing it does the same; a number that is not a test card is refused, and the expiry and code are not checked.
The kit reads the event's name, date, venue, tickets and add-ons from the API: you write none of them. The order number on its confirmation page is the order's number in the API. On Vite, only the tickets server reads .env.local. A hand-made Vite project needs src/vite-env.d.ts (/// <reference types="vite/client" />), or the typecheck fails on the CSS import; with one tsconfig.json instead of two, put the recipe's server include and "types": ["node"] in it.
The whole kit with its notes is one Markdown file: https://rcms-tickets-test.web.app/kit/kit.md. The manifest's documents list holds its checksum.
A whole example#
The example site, https://rcms-tickets-test-yrd.web.app, is a festival site built this way: the kit copied by its own tool, re-themed in the site's own type and colour, a five-ticket pack, a code, buyer details with a date of birth and a text opt-in, the ad consent banner, an abandoned-checkout email on hold.expired, and a server of a few Cloud Functions with the key in Secret Manager. Its source is not public yet.
On a page that already has a heading#
The kit shows the event's name as an h1. On a page with its own h1, pass eventHeading="h2" to make it an h2, or eventHeading={false} to leave the name out (the dates and venue stay). Every field has a name and a type (name, email, phone, code, cardnumber, q_<question key>, ticket_2_name), so a password manager or autofill knows them; there are no data-testid hooks, so a test finds a field by its label.
On a new folder with no git yet, run git init before step 4: the check for an ignored .env.local needs a repository. A new Vite project is npm create vite@latest my-site -- --template react-ts; apply the recipe after it.
Re-theme it#
On a site with a background of its own, set --rt-canvas: transparent: the kit's canvas is a light grey that ends where its content ends, so otherwise your background shows as a strip below it, most plainly under the Continue bar on a phone.
A handful of variables at the top of checkout.css: --rt-accent, --rt-on-accent, --rt-accent-ink, --rt-radius, --rt-font, --rt-canvas, --rt-surface. Or pass one brand colour to brandStyle('#c8102e'), which keeps your colour and picks words that stay readable on it. Light and dark follow the buyer's phone.
Payment#
The payment step has one slot.
- Test mode: the kit's own card form takes the test cards and sends only a test token. The confirmation's "We sent your tickets" is the same as in live mode, though test mail reaches only members of your organization. Test mode.
- Square: the buyer's card is tokenized in Square's frame and only the token reaches your server. The kit authorizes the hold's total, makes the order, and only then takes the money (delayed capture). A refused order voids the authorization, with no fee and no refund. If the platform charges you a fee, a sale through this slot records
external, so the fee is owed and invoiced, not taken on the sale: see status. - Another processor: a server slot and a browser slot. A processor that charges at once leaves a gap: if your server dies after the charge and before the order, the buyer has paid for nothing until a person looks. A live key refuses such a processor unless you give it a way to refund and say that you know.
- A slot of your own that sends the API
provider: 'square'can get apendingorder back. The kit's confirmation says so ("Almost done", no tickets, nothing paid) until the order is paid.
Node 26 and your own fetch#
On Node 26 the built-in fetch offers HTTP/2. Per origin, on a warm connection, it sends requests with a body one at a time, and anything sent behind one waits its turn, with no error. What decides it is whether the request has a body, not its method. A busy on-sale queues behind that connection (four buyers a second took 140 s each). The kit calls the API and Square with serverFetch, which speaks HTTP/1.1 through Node's https there and is the plain fetch everywhere else.
NODE_USE_ENV_PROXY=1or--use-env-proxywithHTTPS_PROXY: the calls go through your proxy, at once.- A global dispatcher that is anything but a bare
new Agent()(ProxyAgent,EnvHttpProxyAgent,MockAgent,.compose(), anAgentwith a private CA or alookup): the platform'sfetch, so yours is honoured, and on Node 26 the stall comes back. For a CA alone,NODE_EXTRA_CA_CERTSkeeps both. - A
fetchpassed tocreateCheckoutorsquarePaymentis used as it is. One onglobalThis.fetch, a test's stub or a tracing wrapper, is called as given: a wrapper keeps working, and on Node 26 it stalls and says so once with aconsole.warn. To keep the wrapper and lose the stall, wraphttp1Fetchand pass that asfetch. - Next: the kit's routes need nothing. On Node 22 the platform's
fetchand your cache rules apply (force-cacheandonly-cachekeep the answer,next: { revalidate, tags }is honoured); otherwise the call saysno-store. On Node 26 Next never sees the call: nothing is kept,next: { ... }is dropped, and a page that calls the API as it renders saysexport const dynamic = 'force-dynamic'. - A write is never sent twice on a redirect: it is an error that says so.
Before real money#
A live key must set clientIp for your hosting, or createCheckout refuses to start: the buyer's address is what stops one visitor holding a whole sale for free (KIT.md, "The buyer's address").
Live mode is open only for an organization we have cleared, so ask us before you follow this list. The manifest's live list is the authority, in order: verify the copy against kit.lock, update if there is an advisory, set the live key and base URL in production only, switch to the Square slot, register the webhook (order.paid, order.created, hold.expired) and keep its secret, schedule the sweep every 15 minutes, wire the cookie banner, send onError to a person, say where the buyer's address is on your hosting, and buy one real ticket and refund it.
Updates and advisories#
Your copy says its version on every API call (rcms-tickets-kit), and kit.lock records a checksum for every file as installed. That lets us tell you when a version has a problem, and lets you see what you changed.
node src/rcms-tickets/tools/kit.mjs verify
node src/rcms-tickets/tools/kit.mjs update --manifest https://rcms-tickets-test.web.app/kit/manifest.json- The manifest is signed (ed25519,
manifest.json.sig), and the tool checks it against a public key built into the tool before it writes anything. A changed manifest stops with a plain message. The first install trusts this page and its TLS, which nothing can improve on; every update after it checks the signature. - The tool refuses an older version without
--allow-downgrade. - To check the signature yourself, with OpenSSL 3 (macOS's own
opensslis LibreSSL and cannot): the public key is thePUBLIC_KEYline in the tool you ran, and the manifest names the same key undersigning.public_key. Compare it with a copy you got another way, because a tool and a manifest served together are only as trusted as the page that served them.
KEY=$(grep -o "PUBLIC_KEY = '[^']*'" src/rcms-tickets/tools/kit.mjs | cut -d"'" -f2)
(echo '-----BEGIN PUBLIC KEY-----'; echo "$KEY"; echo '-----END PUBLIC KEY-----') > key.pem
base64 -d < manifest.json.sig > sig.bin # macOS: base64 -D
openssl pkeyutl -verify -pubin -inkey key.pem -rawin -in manifest.json -sigfile sig.bin- A file you did not change is replaced; a file you changed is kept, the new copy goes in
.kit-update/and the diff is printed. Merge by hand, thenupdate --accept <path>. - An advisory is printed first and stays until the file it is about has really moved. An agent doing an update should read every advisory and say it to the owner.