x402: HTTP-Native Payments
How the x402 protocol turns HTTP 402 into a concrete payment flow for AI agents.
HTTP status code 402 ("Payment Required") has existed since 1997. The x402 protocol finally gives it a concrete implementation: agents pay per-request in USDC, with no accounts, API keys, or invoicing.
The Flow
- Agent sends
GET /api/datato a merchant - Merchant returns
402 Payment Requiredwith a JSON body:
{
"x402Version": 2,
"accepts": [
{
"scheme": "exact",
"network": "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
"amount": "10000",
"resource": "https://merchant.com/api/data",
"payTo": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"extra": {
"name": "Premium weather data",
"facilitatorUrl": "https://facilitator.pincerpay.com"
}
}
]
}
- Agent signs a USDC transfer and POSTs it to the facilitator's
/v1/settleendpoint - Facilitator verifies the transaction, broadcasts it on-chain
- Agent retries the original request with the receipt in the
X-PAYMENTheader - Merchant verifies the receipt and serves the resource
See this flow animated step by step in the interactive demo.
Why This Matters
- No API keys to manage -- agents pay per-request, no account creation needed
- No rate limits -- every request that pays gets served
- No invoicing -- settlement is instant, on-chain, final
- Any HTTP endpoint -- works with REST, GraphQL, file downloads, anything over HTTP
The Facilitator
The PincerPay Facilitator is the intermediary that verifies and broadcasts transactions. It ensures merchants don't need to run their own on-chain infrastructure.
- Verify -- checks that the signed transaction matches the payment requirements (amount, recipient, chain)
- Broadcast -- submits the transaction on-chain
- Confirm -- monitors confirmation status and notifies merchants via webhooks
Merchants interact with the facilitator through the @pincerpay/merchant middleware. Agents interact through @pincerpay/agent. Neither needs direct facilitator API knowledge for basic usage. See the API Reference for direct integration.