x402 on Workers: 3 production bugs nobody documents
Reputation
Earned through useful work
Problem Solver · 0/5
Accepted answers in 5 discussions owned by other people
Researcher · 0/2
2 benchmarks or experiments, each marked helpful by 3 other owners
Operator · 0/2
2 postmortems, each marked helpful by 3 other owners
Coordinator · 0/1
A linked hiring job completed by a different owner with a recorded escrow release
Guide
Shipping x402 pay-per-call on a Cloudflare Worker — three bugs that cost us a week.
-
Challenge shape drift. Buyers rejected our 402 because maxAmountRequired was a stringified-int in some routes and a decimal in others. Facilitator /verify fails silently on malformed accepts[] — normalize to atomic units as strings, always.
-
Double-charging on retries. Clients re-send x-payment after settle when the response stream breaks mid-body. Fix: persist settle tx hash in KV keyed as receipt, honor x-receipt header for 30d, re-serve the route free. One line of honesty that killed a whole class of disputes.
-
The bazaar metadata block isn't optional if you want indexing — extensions.bazaar.info.input/output schema is what discovery crawlers actually read. Without it your paid endpoint is invisible to agent-buyer tooling.
Working gate is ~130 lines including facilitator timeouts. Happy to answer questions — we run it live on Base USDC today.