What Is the x402 Payment Protocol?

The protocol that turns HTTP 402 "Payment Required" into reality — letting AI agents pay for API calls with USDC, natively built into the web.

Published March 15, 2026 7 min read By AsterPay

For decades, the HTTP status code 402 Payment Required was "reserved for future use." In 2025, Coinbase shipped the future: the x402 payment protocol, which lets any HTTP endpoint require a USDC payment before returning data.

This is the protocol powering the AI agent economy. Here's everything you need to know.

How x402 Works: The 60-Second Explanation

  1. An AI agent makes an HTTP request to an API endpoint
  2. The server responds with HTTP 402 and a payment requirement (e.g., "0.004 USDC on Base")
  3. The agent's wallet signs a USDC transaction
  4. A facilitator (like AsterPay) verifies the payment and settles it
  5. The server returns the actual data

The entire flow happens in milliseconds. No API keys, no subscriptions, no invoices. Just pay-per-call.

# A real x402 request flow:

# 1. Agent makes request
GET /v1/market/price/BTC HTTP/1.1
Host: x402.asterpay.io

# 2. Server responds with 402 + payment details
HTTP/1.1 402 Payment Required
X-Payment: {"amount": "0.004", "currency": "USDC", "chain": "base"}

# 3. Agent pays and retries
GET /v1/market/price/BTC HTTP/1.1
X-Payment-Proof: {signed_transaction}

# 4. Server delivers data
HTTP/1.1 200 OK
{"price": "67234.50", "currency": "USD", ...}

Why x402 Matters for AI Agents

Traditional payment methods (Stripe, invoices, subscriptions) require a human in the loop. An AI agent can't fill out a Stripe checkout form. x402 solves this by making payments machine-native:

The x402 ecosystem is growing fast. As of March 2026, the x402.org/ecosystem lists providers across settlement, tooling, and infrastructure. AsterPay is the only provider offering EUR settlement via SEPA Instant for x402 payments in Europe.

x402 vs. Google AP2 vs. Traditional Payments

x402 isn't the only agent payment protocol. Google recently launched AP2 (Agent Payments Protocol). Here's how they compare:

AsterPay supports both x402 and AP2, giving your agents maximum interoperability.

How to Accept x402 Payments

If you're an API provider and want to monetize with x402:

Option 1: Use AsterPay as Your Facilitator

// In your Express/Fastify/Next.js API:
import { x402Middleware } from '@asterpay/x402-sdk';

app.use('/v1/*', x402Middleware({
  facilitator: 'https://x402.asterpay.io',
  price: '0.004',  // USDC per call
  currency: 'USDC',
  chain: 'base'
}));

AsterPay handles payment verification, settlement, and compliance. You receive EUR via SEPA Instant.

Option 2: Self-Host

x402 is an open protocol. You can run your own facilitator, but you'll need to handle settlement, compliance, and multi-chain support yourself.

The EUR Settlement Gap

Here's the challenge most x402 providers don't solve: your AI agent pays in USDC on Base, but you — the European merchant or developer — want euros in your bank account.

AsterPay bridges this gap. Every USDC payment that flows through our facilitator can be automatically settled to EUR via SEPA Instant. No manual conversion, no exchange accounts, no delays.

AsterPay is listed on the official x402.org ecosystem as the European EUR settlement provider. We're the only x402 facilitator offering SEPA Instant settlement.

Get Started with x402

  1. For AI agent developers: Install npx @asterpay/mcp-server or pip install asterpay
  2. For API providers: Add x402 middleware to your endpoints — see docs
  3. For merchants: Apply for EUR settlement

Join the x402 Economy

The AI agent payment revolution is here. Start accepting or making x402 payments today.

Create Free Account Read the Docs