Explainer

x402: how AI agents pay for the web — and why we applied on Cloudflare

x402 is an open payment standard built around HTTP status code 402, "Payment Required" — a code reserved since the web's early days that never had a standard behind it. With x402, a server can answer any request with a machine-readable price, and a client — human tooling or an AI agent — can pay it automatically with a wallet-signed payment. No account creation, no API keys, no checkout form, no stored credit card. The protocol lives at x402.org under the x402 Foundation, and Cloudflare supports it natively in its Agents SDK and its Monetization Gateway.

How an x402 payment actually works

  1. The client requests a resource: GET /resource.
  2. The server responds 402 Payment Required with a PAYMENT-REQUIRED header — Base64-encoded payment requirements: price, token, network, and the merchant address.
  3. The client signs a payment payload with its wallet for exactly that amount.
  4. The client retries the same request with a PAYMENT-SIGNATURE header.
  5. The server verifies the payload — directly, or via a facilitator's POST /verify endpoint.
  6. The facilitator broadcasts the transaction (POST /settle); it never holds the funds.
  7. The server delivers the resource, with a PAYMENT-RESPONSE header confirming settlement.

Two payment schemes exist today: exact (a fixed amount, e.g. ERC-20 USDC) and upto (authorize a maximum, settle what was consumed). Supported networks include Base, Ethereum, Polygon, Optimism, Arbitrum, Avalanche, Solana, Aptos, Stellar and Sui, with base-sepolia for testing.

Why this matters for MCP servers and agents

Machine traffic breaks the two payment models the web has: ads assume human eyeballs, and subscriptions assume a human who can fill a checkout form and remember a login. An agent calling a validation API two hundred times during one build can do neither. Per-call payment is the shape that fits machine consumption — and x402 puts it directly into the protocol layer the agent already speaks: HTTP. Cloudflare's Agents SDK ships this as working parts — x402-hono middleware to charge for Worker endpoints, @x402/fetch for clients that pay automatically, and agents/x402 for MCP clients — which means individual MCP tools can carry a price, settled per invocation, with no key management on either side.

Where MotionSpec stands

MotionSpec runs a free, keyless MCP server at api.motionspec.dev/mcp with two tools: motion_catalog and motion_validate. Those stay free. Validation is the trust boundary of the ecosystem — the more agents check their motion, the better, so we keep the barrier at zero (you can try it in the browser without installing anything).

At the same time, we've applied for Cloudflare's x402 monetization path. To be precise about status: applied, not enabled — and no pricing is announced. The reason is capacity planning, not a paywall on what exists today: if agent platforms start pushing heavy, sustained compile workloads through MotionSpec, per-call x402 metering is the honest way to sell that — the agent pays for exactly what it uses, at the moment it uses it, over the same HTTP request it was already making. When x402 is the standard rail for agent payments, being reachable on that rail from day one matters. For what the MCP does and how to install it in Claude, see the setup guide.

FAQ

What is HTTP 402?

"Payment Required" — a status code reserved for decades without a standard. x402 defines the payment requirements, signature and settlement flow that make it usable.

Do agents need a credit card?

No — a crypto wallet. The agent signs the exact amount from the 402 response and retries the request with the signature attached.

Is the MotionSpec MCP paid?

No. motion_validate and motion_catalog are free and keyless, and stay that way. The x402 application prepares optional metering for future heavy workloads only.

What settles the payment?

Typically stablecoins such as USDC, on any of the supported networks; a facilitator (for example the one operated by Coinbase at x402.org) verifies and broadcasts, without holding funds.

Try the tool agents will call.

Run the live motion_validate tool in your browser — free, keyless, nothing stored.

Open the MCP playground

Generating web UI at scale? See the Design Partner Program.