Back to blog
7 min read

x402, explained for builders

x402 is one of those rare specs where the value lives in how small it is. It is an open protocol that lets any HTTP resource quote a price and any client pay inline, using stablecoins, without a checkout flow. For agentic payments, it is the missing handshake.

The HTTP 402 Payment Required status code has been reserved since 1997 and unused at any real scale ever since. x402, shipped by Coinbase, finally gives it a job: it is the response a resource sends when it wants to be paid, with just enough machine-readable detail for the caller to pay and try again.

The shape of an x402 exchange

  1. A client calls a paid resource.
  2. The server responds 402 Payment Required with a JSON body describing accepted assets (e.g. USDC on Base), the recipient address, the amount, and a nonce.
  3. The client signs a payment payload referencing those details.
  4. The client retries the original request with an X-Payment header.
  5. The server verifies, settles on-chain, and returns the real response.

Why this matters for agents

An agent is, at heart, a thing that makes HTTP requests in a loop. Every existing payment rail forces the agent out of that loop: open a browser, fill a form, click a button, copy a code, wait for an email. x402 keeps the agent in the loop. A paid resource is just a resource that sometimes returns 402.

What x402 is not

  • It is not a wallet. The spec assumes the client can sign a payment. Where the keys live and who decides whether to sign are out of scope.
  • It is not a policy engine. Nothing in x402 cares whether the caller should be paying this amount to this merchant right now. That is the job of the layer above.
  • It is not chain-specific. The protocol is asset and network agnostic. Merchants advertise what they accept; clients pick from that list.

Where Vayr Pay fits

Vayr Pay implements the client side of x402 on behalf of your agents, plus everything the spec deliberately leaves out: the policy check before signing, the approval flow for large payments, the receipt log, and the connection to your wallet provider. Your agents make normal HTTP calls. When a merchant returns 402, Vayr Pay handles the rest, only signing when your policy says it should.

If you are building agents that need to pay for real things on the open internet, x402 is the wire format you want them to speak. The governance around it is the part you want to outsource.

x402protocolsdevelopers

Building agents that need to pay for things?

Join the Vayr Pay waitlist for early access.

Join the waitlist