x402
ProductionHTTP 402 Payment Required — Coinbase
Overview
x402 is Coinbase's open protocol for machine-to-machine payments using the HTTP 402 status code. When an AI agent hits a paid endpoint, it receives a 402 response with on-chain payment instructions. The agent pays with USDC, and the server verifies the payment before serving the response. SettleGrid runs a public x402 facilitator (verify + settle on Base) as a standalone service; the metering, budgets, and analytics layer SettleGrid adds on top — and settling x402 through the hosted proxy for your own tool's revenue — is in development.
How It Works
The x402 flow begins when an AI agent sends a request to a paid endpoint without a payment header. The server responds with HTTP 402 and a JSON body specifying the price, the accepted token (USDC), network, and a payment address. The agent constructs an on-chain transaction, signs it, and resends the request with the payment proof in a custom header.
The server verifies the on-chain payment (checking amount, recipient, and confirmation status) before processing the request. This creates a trustless, permissionless payment channel between any two machines on the internet.
On top of that on-chain flow, SettleGrid is building a platform layer that adds credit-based budgets, rate limiting, and analytics. When that layer is live, instead of raw on-chain verification on every call, consumers will be able to pre-fund a credit balance with USDC and let SettleGrid handle the metering — reducing gas costs and latency while keeping the crypto-native payment model. That metering, budgets, and analytics layer — settling x402 through SettleGrid's hosted proxy for your own tool's revenue — is in development; the standalone facilitator that verifies and settles x402 on Base is live today.
How SettleGrid Integrates
SettleGrid runs a live standalone x402 facilitator: three API endpoints handle the flow — /api/x402/verify and /api/x402/settle verify and settle USDC payments on Base, and /api/x402/supported lists the accepted networks. Settling x402 through SettleGrid's hosted proxy on your tool's behalf — crediting your developer balance and metering each invocation — is in development. When that platform layer is live, a consumer's agent sends an x402 payment header, SettleGrid verifies the transaction, credits the developer's balance, and meters the invocation; developers receive payouts in fiat via Stripe Connect regardless of how the consumer paid.
Key Specs
| Protocol | x402 — HTTP 402 Payment Required |
| Backer | Coinbase |
| Detection Header | X-402-Payment / X-Payment-* |
| Identity Type | wallet-address |
| Payment Type | on-chain USDC (Base) |
| Status | Production |
Code Example
Here is how a developer's tool works with x402 via SettleGrid:
import { settlegrid } from '@settlegrid/mcp'
const sg = settlegrid.init({
toolSlug: 'blockchain-analytics',
pricing: { defaultCostCents: 25 },
// x402 payments are verified automatically
// Consumer agents pay with USDC on-chain
})
const analyze = sg.wrap(async (args: { address: string }) => {
const analysis = await analyzeWallet(args.address)
return { content: [{ type: 'text', text: JSON.stringify(analysis) }] }
}, { method: 'analyze-wallet' })Start monetizing with SettleGrid
Free forever — 50,000 ops/month, progressive take rate. Add billing to your x402 tool in under 5 minutes.
Get Started Free