Can I run x402 on Cloudflare Workers?
Yes — Workers are a great fit. x402 is just HTTP: your Worker returns a 402 with payment terms, then verifies the X-PAYMENT header against a facilitator before serving the response. Because Workers run at the edge with no cold servers to manage, they suit the small, frequent payments AI agents make. (This very site runs on Cloudflare.)
What is Cloudflare’s "pay per crawl"?
Cloudflare introduced pay per crawl, which uses the HTTP 402 status code to let publishers charge AI crawlers for access instead of blocking them outright. It is the same 402-based idea x402 formalizes: a server asks to be paid before returning content. The two reflect a broader shift toward 402 as the way machines pay for web resources.
Do I need a specific Cloudflare product for x402?
No special product is required — a standard Worker plus a facilitator and a wallet is enough. Cloudflare’s platform (Workers, KV/D1 for state, queues) simply makes it convenient to deploy and scale an x402 endpoint globally.
How does the Worker verify a payment?
It does not need to touch the chain. The Worker passes the payment proof to an x402 facilitator, which verifies and settles on-chain, then returns a confirmation. Your Worker only branches on "paid / not paid". See our facilitators page.
Where do I keep secrets and state?
Use Workers secrets/environment bindings for keys (never process.env at module load — read them per request from the runtime), and D1 or KV for any usage records. This mirrors how a production x402 endpoint on Cloudflare is structured.