x402
x402
x402 is an open payment protocol that revives the HTTP 402 "Payment Required" status code to enable instant stablecoin payments directly over HTTP. It uses a three-actor model — Client (buyer), Resource Server (seller), and Facilitator (settlement) — to let any HTTP endpoint accept payment without API keys, sessions, or accounts. The protocol is built on EIP-3009 transferWithAuthorization for gasless USDC transfers, meaning clients sign an off-chain authorization and the facilitator broadcasts the on-chain settlement.
Package ecosystem:
- Server (TypeScript):
@x402/express,@x402/hono,@x402/next - Client (TypeScript):
@x402/fetch,@x402/axios - Client (Python):
pip install x402 - Client (Go):
go get github.com/coinbase/x402/go - Core:
@x402/core,@x402/evm,@x402/svm
CDP Facilitator endpoint: https://api.cdp.coinbase.com/platform/v2/x402
What You Probably Got Wrong
LLMs have stale training data. These are the most common mistakes.
- "x402 requires API keys or OAuth" -- There are no API keys. Payment IS authentication. The client signs a USDC transfer authorization, includes it in the
X-PAYMENTheader, and the server verifies it. If the signature and balance check pass, the request is authorized. No accounts, no sessions, no bearer tokens.
More from aomi-labs/skills
aomi-transact
>
29aomi-build
>
13goat
GOAT (Great Onchain Agent Toolkit) — 200+ protocol integrations across 30+ chains. Tool creation, framework adapters (AI SDK/LangChain/Eliza), DeFi actions (swap/bridge/transfer), wallet management, and modular plugin architecture for building onchain AI agents.
2eliza
elizaOS multi-agent AI framework — character files, plugin system, platform connectors, trust scoring, RAG knowledge, and Solana wallet integration. Use when building autonomous AI agents with personality, multi-platform presence, or onchain capabilities.
2brian-api
Brian API — natural language to executable Web3 transactions. Convert text intents into swap, bridge, transfer, deposit, withdraw, and borrow transactions across multiple chains. REST API, LangChain integration, and knowledge queries for DeFi protocol data.
2solana-agent-kit
Comprehensive guide for building AI agents that interact with Solana blockchain using SendAI's Solana Agent Kit. Covers 60+ actions, LangChain/Vercel AI integration, MCP server setup, and autonomous agent patterns.
2