How Do AI Agents Pay for Things? HTTP 402, Explained.
AI agents pay over HTTP 402: the server quotes a price, the agent pays and retries with proof, and gets the resource. x402, MPP, and Pay Per Crawl run on it.
TL;DR: An AI agent pays for a web resource the way any HTTP client fetches one, with one extra round trip. The agent requests the resource, the server answers 402 Payment Required with a price, the agent pays and retries the request carrying proof of payment, and the server verifies that proof and returns the resource with a receipt. Every current machine payment protocol (x402, the Machine Payments Protocol, Cloudflare’s Pay Per Crawl) is that same four-step exchange wearing different headers.
Part 1 of 5 in the Field Notes series When Agents Pay. Next: should you charge AI crawlers, allow them, or block them.
That is the entire mechanism. The rest of this post explains why it took thirty years to arrive, what the three live protocols actually differ on, and what has to be true about your business before any of it earns money.
What actually happens when an agent hits a 402?
Four steps, all inside normal HTTP. Cloudflare’s agentic payments documentation describes the shape shared by every protocol it supports:
- Request. The client (an agent, a crawler, a script) asks for a resource or calls a tool. Nothing about the request is special.
- Challenge. The server responds
402 Payment Requiredand includes a payment challenge: the amount, the accepted payment methods, and where the payment should go. - Pay and retry. The client fulfills the payment and sends the same request again, this time carrying a payment credential (a signed payload, a token, a receipt reference) in a header.
- Verify and serve. The server verifies the credential, optionally by asking a facilitator service to check and settle it, and returns the resource along with a receipt.
The line in Cloudflare’s docs that matters most for business owners is this one: “No pre-created service account or pre-shared API key is required.” The agent did not sign up. Nobody negotiated a contract. A price was quoted and paid, and a resource changed hands, in the time an ordinary web request takes.
Compare that to how machine access is sold today: API keys issued after a sales call, monthly plans, invoices, dashboards. That model works when the buyer is a company committing to a year. It fails completely when the buyer is a piece of software that wants one lookup, right now, for a fraction of a cent.
Why did nobody use 402 until now?
HTTP has had a 402 Payment Required status code since the 1990s. The original specification reserved it for future use and never defined what “payment” meant. Two things were missing.
The first was a buyer. Until recently, the only clients on the web were browsers driven by people, and people pay through checkout pages, not status codes. AI agents changed that. An agent running a research task, a booking, or a data pipeline can hold a budget and spend it without a human clicking Buy.
The second was a payment rail cheap enough for tiny amounts. Card networks were built for purchases measured in dollars, not tenths of a cent. Stablecoins settling on fast chains, and card-network products designed for agents, both closed that gap in the last two years. Once a payment can cost less than the thing it buys, 402 stops being theoretical.
So the code was never wrong. It was early.
What are x402, MPP, and Pay Per Crawl, in one paragraph each?
Three protocols get named whenever machine payments come up. They are not competitors in the sense of a format war; they occupy different positions on the same mechanism.
x402 is the stablecoin-first protocol, created by the x402 Foundation with facilitator infrastructure operated by Coinbase. Cloudflare’s x402 documentation describes a flow using three headers: PAYMENT-REQUIRED on the 402 response, PAYMENT-SIGNATURE on the retry, and PAYMENT-RESPONSE on the settled reply. Payments are USDC on Base and a list of other chains. An optional facilitator verifies the payment payload and submits it to the chain; it never holds funds. Cloudflare’s Agents SDK ships helpers (x402-hono, paidTool, withX402Client) so a Worker or an MCP server can charge in a few lines.
MPP, the Machine Payments Protocol, is the payment-method-agnostic one, co-authored by Tempo and Stripe and published at mpp.dev. It standardizes 402 with a formal Payment authentication scheme proposed to the IETF, using WWW-Authenticate: Payment for the challenge and Authorization: Payment for the credential. It supports stablecoins, cards through Stripe, and custom methods, and Cloudflare’s MPP documentation notes it is backwards-compatible with x402: “MPP clients can consume existing x402 services without changes to those services.”
Pay Per Crawl is Cloudflare’s own application of 402 to a specific buyer: AI crawlers. Per the Pay Per Crawl documentation, a site owner sets a price, and a crawler either presents payment intent in its request headers and gets 200, or receives a 402 with the price. Cloudflare acts as Merchant of Record and handles the infrastructure. It is in closed beta as of this writing.
Part 3 of this series puts x402 and MPP side by side. Part 2 covers Pay Per Crawl and the allow, charge, or block decision.
What would your business actually sell this way?
The mistake is to imagine machine payments as a new storefront for the things you already sell to people. Agents rarely buy those. They buy inputs to their own tasks, and they buy them small.
The pattern that clears economically is value that is real but too granular to sell through a human process. A verification lookup that costs you nothing to serve but saves the buyer an afternoon. A generated report priced at a dollar. A capacity or availability check a competitor’s agent would happily pay a nickel for. A tool call that returns a computed answer from data only you hold. None of those justify a sales conversation. All of them are sellable when the buyer is software and the transaction costs nothing.
That is the inventory question at the center of our agentic commerce work: which of your data and capabilities would an agent pay for, at what price, and is the list long enough to bother. Sometimes it is thin. We say so.
What has to be true before you build it?
Machine payments sit at the top of a stack, and the stack has to exist first. Four conditions:
- You are discoverable and understandable to machines. An agent that cannot find your capability or parse what it does will never reach the 402. This is the ground floor of the six-level Agent Readiness framework, and it is where most businesses actually are. If you want the plain-language version, start with what it means to be discoverable in an AI-powered web.
- You know who is asking. A price is meaningless if you cannot verify the identity of the client presenting a credential. Cloudflare’s Pay Per Crawl requires crawlers to be identified through Web Bot Auth for exactly this reason. Part 5 covers it.
- You have priced inventory. A monetization map, not a hunch. Which resources, which price, free tier or not.
- The boring parts are engineered. Server-side verification of every payment. Idempotent fulfillment so a retried request never double-charges. Receipts. Scoped access so a paid lookup cannot leak the whole dataset. Every protocol above leaves these to you.
Skip any one of them and you have built a vending machine nobody can find, or one that gives away the stock.
Where does this leave you?
Machine payments are real, shipping, and small. Real: the protocols exist, the SDKs exist, and Stripe and Cloudflare are on the field. Shipping: you can put a price on a Worker route or an MCP tool this week. Small: in most markets the number of agents carrying budgets is still low, which is why the right sequence is agent-accessible data first, payments designed but dormant, and activation when the demand shows up.
The question isn’t whether agents will pay for things. They already do. The question is whether your infrastructure can quote a price when one asks.
Want to know where your business sits on this stack?
Bold Crow AI designs machine-payment flows on open standards (HTTP 402, x402, MPP) and, more often, tells clients which stage they are actually in. The Agent Readiness Audit is where that starts: evidence of how agents see you today, and a scored map of what to build next.
Contact Bold Crow AI to talk through what an agent would pay you for.