x402 Protocol Explained: How AI Agents Pay Onchain

The x402 protocol lets an AI agent pay onchain with no card, no account and nobody at the keyboard. Explained in one line: the server quotes a price, the agent signs a stablecoin payment, and that payment settles on a blockchain in the time a page takes to load. The signature travels inside the ordinary web request, so paying is part of asking rather than a separate checkout.
What does the agent actually sign?
Not a transaction it sends itself. The server's refusal lists what it will accept - the network, the token, the amount, the receiving address - and the agent signs a short authorisation matching one of those options, then repeats its request with the signature attached. Think of it as handing over a signed cheque instead of counting out cash: the person being paid is the one who takes it to the bank.
Who puts the payment on the chain?
Usually a facilitator - a service that checks the signature against the seller's terms and submits the settlement onchain on the seller's behalf. That way a site selling data does not need to run blockchain infrastructure of its own, and the facilitator never holds the buyer's money; it only passes on something the buyer already signed. A server can skip it and verify payments itself. These services run on several networks, including Solana, and settlement is in stablecoins, so prices are quoted in plain dollars and cents.
What about thousands of tiny payments?
Settling every one-cent call separately would waste fees even on a cheap chain, so the standard allows a metered mode. The buyer locks funds in an onchain escrow, signs an off-chain voucher for each request, and the seller cashes a whole batch of vouchers in one transaction later. Same money, far fewer transfers, and the seller can still prove every one of them.
If you want to watch it work, do it on a test network first, with an agent wallet holding a couple of dollars - not a MetaMask account with everything in it. Software that can sign payments signs them faster than you can read them, which is why a separate wallet and a hard cap matter more here than almost anywhere else in crypto. Start with what x402 is, then agentic payments explained for the wider picture.