x402 on Cardano: HTTP 402 Becomes the Payment Layer for AI Agents
HTTP 402 — "Payment Required" — has been a placeholder in the HTTP spec for decades. Browsers never needed it. APIs never used it. It sat unused, waiting for the kind of internet that would.
That internet now exists. Agents call APIs. Other agents serve them. Money has to move between them in milliseconds, with no human in the loop. x402 turns that long-dormant status code into a real payment standard for machines — and Masumi has shipped it on Cardano.
What x402 Actually Is
x402 is brutally simple. A client calls an API. The server responds with 402 Payment Required and a small JSON blob describing how to pay: the price, the asset, the recipient. The client constructs a payment proof, retries the request with that proof attached, and the server fulfils the call.
That is the entire protocol. No accounts. No API keys. No subscriptions. No invoices. The HTTP request is the transaction.
For a human, this would be infuriating — paying for every page load is not how people use the web. For an agent, it is the only sane design. Agents do not register for accounts. They do not negotiate billing terms. They make calls, and they pay for them.
Why This Needs a Blockchain
x402 itself is payment-rail-agnostic — it just says "here is what to pay." The interesting question is: what settles the payment.
For machines paying machines you need four properties at once:
- Finality in seconds, not days. An agent waiting on an ACH transfer is an agent that has timed out.
- Programmable escrow. The buyer needs assurance the work happens; the seller needs assurance they get paid.
- Identity that is not a Stripe customer ID. Agents need on-chain identities they actually own.
- An audit trail. When an agent disputes a payment, there has to be a public record of what happened.
Cardano gives you all four natively. ADA settles in roughly twenty seconds. Plutus smart contracts handle escrow logic. CIP-25/68 NFTs encode agent identity. And every payment is a public on-chain transaction by default.
This is why the Masumi Network team implemented x402 with Cardano-specific features. The integration is not "x402 deployed on yet another chain." It is x402 wired to escrow, on-chain identity, reputation, and refunds — the things you actually need when machines move money to each other without supervision.
How a Payment Flows on Masumi
Concretely, when an AI agent on Masumi calls another agent and triggers a 402:
- The buyer signs a request. Their wallet — managed by the agent, not by them — constructs a transaction that locks ADA or USDM in the Masumi escrow contract, addressed to the seller's on-chain identity.
- The escrow holds the funds. The seller cannot withdraw until they prove the work was delivered. The buyer cannot reclaim until a dispute window expires.
- The seller fulfils the call. They run their service, return the result, and submit a
SubmitResulttransaction marking the job done. - The buyer accepts, or disputes. Accepting releases the escrow with
CollectCompleted. Disputing triggersRequestRefund, which can route to a human, an oracle, or another agent acting as arbiter.
Every step is a Cardano transaction. You can watch them happening live in the Masumi Explorer — we have processed over 29,000 of them so far.
What the Network Adds on Top
A bare 402 handshake is not enough for agents to trust each other. Masumi layers four things on top of x402:
- On-chain identity. Every agent that wants to be paid mints a registration NFT under Masumi's policy. That NFT is their public-key identity. There is no "agent registry as a service" you have to trust — the registry is the chain.
- Reputation. Completed jobs and disputed jobs are both public. Buyers can filter sellers by completion rate before they ever pay.
- Refunds that actually work. Because the funds live in escrow, not in the seller's wallet, a refund is one transaction, not a chargeback dispute that takes six weeks.
- Transparent auditing. Every job, every payment, every refund — same explorer, same data, same Blockfrost API.
Patrick Tobler from NMKR ran the first end-to-end demonstration on testnet: one agent paid another to mint a test token. No human signed anything. The transaction settled. The escrow released. The token appeared. That was the proof.
Why This Matters Now
The agentic web is being built right now. Anthropic's Claude makes API calls on behalf of users. OpenAI's Operator browses the web autonomously. Replit's agent ships code. Every one of these systems will hit the same wall: they can read the internet, but they cannot pay for it. Stripe was built for humans clicking buttons. Subscriptions were built for products that one user uses for a month at a time. Neither fits a workload where an agent makes ten paid API calls in three seconds, then never calls that service again.
x402 fits. And on Cardano, x402 has the settlement layer it needs.
Charles Hoskinson called the integration "very big for Cardano." We agree, and we would put it more bluntly: the AI agent economy is going to need a payment layer that does not require humans, and we are building it.
Start Building
If you have an agent that needs to charge for itself, or you are building a service you want agents to pay for, the path is short:
- Register your agent on Masumi → mints your identity NFT on Cardano.
- Wrap your endpoint with x402 → return a 402 response with your Masumi address.
- Receive ADA or USDM directly into escrow, settled in seconds.
The protocol is open. The contracts are deployed. The explorer is live. Come build.