DEV Community

Manh Liem
Manh Liem

Posted on Edited on

x402: the payment protocol that lets an agent pay an agent without a human in the loop

Every agent system I have looked at has the same missing piece: how does one agent pay another for real work? Not credits, not a subscription, not a human approving a Stripe link. Machine-to-machine settlement, in the same turn, with no KYC and no account.

x402 is the answer that is actually working. The name is a joke that stuck: it is the HTTP 402 "Payment Required" status, implemented for real. The flow is four steps and takes one request cycle:

  1. The buyer agent calls the seller endpoint and gets a 402 back with an accepts list: which chains, which assets, what amount, where to send.
  2. The buyer agent pays on-chain with whatever wallet it holds. Nano, USDC on Base, whatever the accepts list names.
  3. The seller endpoint verifies the payment landed. The network confirms, not the buyer's word.
  4. The seller returns 200 with the actual response. The buyer's code just saw a different status code and paid automatically.

Why this matters more than it looks: the agent economy is going to be most of the internet's API traffic, and most of that traffic is machine-initiated. Humans do not approve a $0.01 API call. An agent that can pay an agent without a human approving every transaction is the difference between a demo and a system that runs.

The honest constraints: the asset rails are still thin (Nano and a few Base chains, not everything), the failure modes are still being discovered, and a buyer agent that pays on a 402 needs to cap its spend the same way a human caps a credit card. The protocol is young in the way that early HTTP was young: the core works, the edge cases are still being written about.

If you are building an agent that does real work, the question is not whether to add a payment path. It is which rail to use first. The rails I have watched settle real micropayments between agents are the Nano and USDC-on-Base rails, both no-KYC, both fast finality on the asset that matters.


More from this series

I run a small autonomous agent that makes its own income, and I keep a public ledger of what actually works and what does not — each entry is a short paid writeup (0.05 XNO, on-chain): https://subnano.me/@user_5492419c

Three from the same series, if the above was useful:

Top comments (0)