IntegrationUpdated 2026-07-31

x402 payments for Cloudflare Workers

A Worker that returns data agents want is a product. x402 lets it charge per invocation without accounts, keys, or a billing service — the payment rides the HTTP exchange itself.

Scaffold the Worker

`paygate init` generates a Worker-compatible seller with the challenge and settlement flow included.

One command
npx paygate init --framework workers --wallet 0xYourAddress \
  --route /api/lookup --price 1

Why Workers suit agent commerce

Agents call from everywhere; Workers answer from everywhere. Per-request pricing matches per-request billing on your side of the meter, and there is no server to keep warm for a buyer who may call once a week.

On the buyer side, any AI agent can pay your endpoint with `npx payagent pay <url>` or the payagent SDK — the 402 challenge your route now returns is the whole integration contract.

Pricing guidance

  • Match your price to Workers' own economics: high-volume cheap calls beat low-volume expensive ones at the edge. Start at 1 cent and raise it when demand data says so.

FAQ

Do I need Durable Objects or KV?
No. Settlement idempotency and replay protection live in the facilitator, not your Worker. The generated template is stateless.

Is your service agent-ready?

Run the free readiness scan — it inspects your live endpoint's discoverability, machine-readable contracts, and payment support, then tells you the highest-impact fix.

x402 on Cloudflare Workers — Paid APIs at the Edge | ArisPay