Commerce

x402 Payment Protocol

HTTP 402 Payment Required for AI agents: machine-to-machine micropayment standard via stablecoins.

What is x402?

x402 is an open payment protocol over HTTP from Coinbase that brings the long-reserved HTTP 402 Payment Required status code to life. The server responds with 402 and a PAYMENT-REQUIRED header, the agent client sends a PAYMENT-SIGNATURE, a facilitator verifies and settles the transaction — all without human involvement.

GET /premium-report HTTP/1.1

HTTP/1.1 402 Payment Required
PAYMENT-REQUIRED: scheme="exact", amount="0.01", currency="USDC",
  network="eip155:8453", recipient="0x..."

# Agent pays and retries the request
GET /premium-report HTTP/1.1
PAYMENT-SIGNATURE: <signed_payment_payload>

HTTP/1.1 200 OK

Why do you need x402?

In a world of autonomous AI agents, a standard for micropayments without human involvement is essential. x402 solves three problems:

  • Pay-per-use API — an agent pays $0.001 per data unit or tool call.
  • AI traffic monetization — the server earns on every agent request without subscriptions.
  • Agent-to-agent billing — one agent pays another for compute resources.

The protocol uses stablecoins (USDC) on Base, Polygon, Arbitrum, and Solana networks. The network identifier uses CAIP-2 format (eip155:8453 = Base). As of April 2026, the protocol had processed around 165 million transactions with roughly 69,000 agents connected.

How do you implement x402?

Three roles in the protocol:

RoleResponsibility
Resource ServerResponds with 402 + PAYMENT-REQUIRED, accepts the retry with PAYMENT-SIGNATURE
Client (AI agent)Parses the 402, forms the payment, adds PAYMENT-SIGNATURE
FacilitatorVerifies the signature and processes the on-chain transaction

Minimal declaration of support in ai-agent.json:

{
  "payments": {
    "x402": "https://api.example.com/x402"
  }
}

Or via a Link header:

Link: <https://api.example.com/x402>; rel="x402-endpoint"

How do we check x402?

The x402 check in the scanner is informational (does not affect the main score). The scanner checks for protocol support declaration in two ways:

  1. GET /.well-known/ai-agent.jsonpayments.x402 field
  2. HEAD / → Link header with rel="x402-endpoint"

The actual payment flow (sending PAYMENT-SIGNATURE, settlement via facilitator) is not tested. If a declaration is found → pass, if absent → fail.

Sources and specifications