x402 Quickstart Kit — 2026-08-23 edition
by Rob Louw
$7
The x402 buyer-side signing code almost nobody publishes correctly — plus the seller side, extracted from a live production x402 service, not a tutorial.
x402 (HTTP 402 repurposed for machine-to-machine USDC payments) reads simple in the spec. It isn't, once you hit EIP-712 domain fields or EIP-3009 authorization signing — the part where a wrong field produces a signature that looks fine and simply never verifies. Most public x402 examples skip buyer-side signing entirely or hand-wave the domain. This kit gives you both sides, in two languages each, correctness-checked against the reference spec source.
What's inside
seller/ — TypeScript, Cloudflare Workers/Hono. PaymentRequirements builder, X-PAYMENT decode, facilitator verify/settle calls, framework-agnostic decision logic. Generalized directly from Fetchgate's own live x402 seller.
seller-express/ — the same seller mechanics ported to plain Node/Express, for anyone not on Workers.
buyer/ — TypeScript + viem. EIP-3009 authorization + EIP-712 signing, a fetchWithPayment() helper that catches a 402, signs, retries, and decodes the response.
buyer-python/ — the identical buyer flow in Python (eth_account + web3.py).
GUIDE.md — facilitator selection, the atomic-units trap, network mismatches, and the EIP-712 domain-name pitfall that has actually broken a real deployment.
See a real sample before you buy: the full seller/ package is posted free at github.com/roblouw2nd/fetchgate/samples — read the actual code, not a screenshot of it.
Why trust the signing code
The buyer-side EIP-3009/EIP-712 code was written directly against the x402 reference TypeScript client's own source (exact files cited in the code's doc comments) and cross-checked by signing the same authorization with the same private key through both the TypeScript and Python implementations — they produce byte-identical signatures. That's strong evidence both compute the domain separator and struct hash correctly and identically.
Honest note
This isn't an npm-installable SDK — it's source you copy in and adapt, small enough to actually read and audit. Not a wallet, not a facilitator, and not a substitute for reading the spec if you're integrating something outside its scope (a different scheme, chain family, or a retry/allowance strategy — this kit signs one payment attempt, no retry loop). Real money moves if you point this at mainnet; test on testnet first, per GUIDE.md.
Who this is for
Anyone integrating x402 as a seller or a buyer who wants working, source-verified reference code instead of re-deriving EIP-712 signing from the spec PDF at 1am.
Single-buyer use — build it into your own product; don't resell the kit's source files themselves as a competing product. Sold by Fetchgate (fetchgate.dev), an agent-facing store. One-time purchase.