This is the official CDP documentation. Community-maintained documentation can be found at x402.gitbook.io/x402. When in doubt, check both sources and the x402 Discord for the latest updates.
General
What is x402 in a single sentence?
x402 is an open-source protocol that turns the dormant HTTP402 Payment Required status code into a fully-featured, on-chain payment layer for APIs, websites, and autonomous agents.
Why not use traditional payment rails or API keys?
Traditional rails require credit-card networks, user accounts, and multi-step UI flows. x402 removes those dependencies, enabling programmatic, HTTP-native payments (perfect for AI agents) while dropping fees to near-zero and settling in ~1 second.Is x402 only for crypto-native projects?
No. Any web API or content provider—crypto or web2—can integrate x402 if it wants a lower-cost, friction-free payment path for small or usage-based transactions.Language & Framework Support
What languages and frameworks are supported?
TypeScript and Python (coming soon) are the reference implementations, but x402 is an open protocol. Nothing prevents you from implementing the spec in Go, Rust, etc. If you’re interested in building support for your favorite language, please open an issue and let us know, we’d be happy to help!Facilitators
Who runs facilitators today?
Coinbase Developer Platform operates the first production facilitator. The protocol, however, is permissionless—anyone can run a facilitator. Expect:- Community-run facilitators for other networks or assets.
- Private facilitators for enterprises that need custom KYT / KYC flows.
What stops a malicious facilitator from stealing funds or lying about settlement?
Everyx402PaymentPayload is signed by the buyer and settles directly on-chain.
A facilitator that tampers with the transaction will fail signature checks.
Pricing & Schemes
How should I price my endpoint?
There is no single answer, but common patterns are:- Flat per-call (e.g.,
$0.001per request) - Tiered (
/basicvs/proendpoints with different prices) - Up-to (work in progress): “pay-up-to” where the final cost equals usage (tokens, MB, etc.)
Can I integrate x402 with a usage / plan manager like Metronome?
Yes. x402 handles the payment execution. You can still meter usage, aggregate calls, or issue prepaid credits in Metronome and only charge when limits are exceeded. Example glue code is coming soon.Assets, Networks & Fees
Which assets and networks are supported today?
CDP Facilitator supports:| Network | Asset | Fees* | Status |
|---|---|---|---|
| Base | USDC | fee-free | Mainnet |
| Base Sepolia | USDC | fee-free | Testnet |
| Solana | SPL Tokens | fee-free | Mainnet |
| Solana Devnet | SPL Tokens | fee-free | Testnet |
- Gas paid on chain; CDP’s x402 facilitator adds zero facilitator fee.
- All networks support any compatible token (EIP-3009 on EVM, SPL on Solana)
I need support for additional networks like Polygon or Avalanche. What should I do?
CDP is actively expanding network support. In the meantime:- Run your own facilitator - the x402 codebase supports Polygon, Avalanche, and other networks
- Submit a feature request through CDP support channels
- Check the x402 Discord for updates on network expansion
Security
Do I have to expose my private key to my backend?
No. The recommended pattern is:- Buyers (clients/agents) sign locally in their runtime (browser, serverless, agent VM). You can use CDP Server Wallet to create a programmatic wallet.
- Sellers never hold the buyer’s key; they only verify signatures.
How do refunds work?
The currentexact scheme is a push payment—irreversible once executed. Two options:
- Business-logic refunds: Seller sends a new USDC transfer back to the buyer.
- Escrow schemes: Future spec could add conditional transfers (e.g., HTLCs or hold invoices).
Usage by AI Agents
How does an agent know what to pay?
Agents follow the same flow as humans:- Make a request.
- Parse the
402 JSON (accepts array). - Choose a suitable requirement and sign a payload via the x402 client SDKs.
- Retry with
X-PAYMENT.
Do agents need wallets?
Yes. Programmatic wallets (e.g., CDP Server Wallet,viem, ethers-v6 HD wallets) let agents sign EIP-712 payloads without exposing seed phrases.
Governance & Roadmap
Is there a formal spec or whitepaper?
How will x402 evolve?
Tracked in public GitHub issues + community RFCs. Major themes:- Multi-asset support
- Additional schemes (
upto,stream,permit2) - Discovery layer for service search & reputation
Why is x402 hosted in the Coinbase GitHub?
We acknowledge that the repo is primarily under Coinbase ownership today. This is primarily to leverage our best-in-house security and auditing team to ensure the spec is safe and nobody accidentally creates legally ambiguous payment flows. We intend to eventually transfer ownership of the repo to a steering group or open-source committee.Troubleshooting
I keep getting 402 Payment Required, even after attaching X-PAYMENT. Why?
- Signature is invalid (wrong chain ID or payload fields).
- Payment amount <
maxAmountRequired. - Address has insufficient USDC or was flagged by KYT.
Check the
errorfield in the server’s JSON response for details.
My test works on Base Sepolia but fails on Base mainnet—what changed?
- Ensure you set
network: "base"(not"base-sepolia"). - Confirm your wallet has mainnet USDC.
- Gas fees are higher on mainnet; fund the wallet with a small amount of ETH for gas.
Still have questions?
- Reach out in the Discord channel • Open a GitHub Discussion or Issue in the x402 repo