1. Install
2. Serve the manifest
One route file, and the SDK owns the format:app/.well-known/bankroll.jwt/route.ts
/.well-known/bankroll-icon.png when you have one.
3. Verify sessions
Every route that matters reads the user from the verified token, never from the request body:bankrollFetch (or
withBankrollToken(fetch)) attaches
the token to every request.
4. Move money
The client callscharge(); your server confirms with
confirmCharge() and checks payee, mint, amount, and payer before
releasing value, then records the signature so it can never be redeemed twice.
Payouts are pay() from your treasury. If you already run a
database, a UNIQUE column on the signature is the replay guard; if you don’t,
the store exists so you don’t have to provision one.
5. Copy the recovery machinery
A charge whose page dies before reporting back still settled — money at your address that nothing points to. The pattern that recovers it (an intent written before the charge, areference carried on-chain, a sweep that finds what was
never reported) is described in
Payments, and the starter ships a
working implementation. It is app code rather than SDK code today — copy it
(MIT) rather than rewrite it:
Adapt
charges.ts to your own price and product; the shape is the part worth
keeping.
6. Wire the dev loop
bankroll dev tunnels your dev server so a phone can reach it (see
Local development). Next.js blocks cross-origin hot-reload by
default, so allow the tunnel in next.config.ts:
npx bankroll dev — or make it your dev script, as the starter does.