Welcome to x402
x402 is an open blockchain payment standard built on the HTTP 402 Payment Required status code. It enables web services to charge for APIs or content through a “pay-before-response” mechanism — without relying on traditional account systems or session management.
x402 currently supports TRON, BNB Smart Chain (BSC), and Base, with plans to expand to a broader multi-chain ecosystem in the future.
Interested in contributing to the documentation?
Feel free to submit a PR to the GitHub repository. Our only principle is to maintain neutrality — aside from essential resource links, please avoid promotional or branded content.
Building with x402?
Install the published @bankofai/x402-* packages in your TypeScript app. The x402 repository ships runnable client → server → facilitator examples under examples/typescript/ for reference — exact, gasfree, upto, and batch-settlement.
Why Use x402?
x402 addresses the core pain points of existing payment systems:
- High fees and complex workflows in traditional credit card and fiat payment channels
- Poor support for machine-to-machine (M2M) payments, such as autonomous AI agent transactions
- Lack of efficient micro-payment infrastructure, making usage-based monetization difficult
- Leveraging blockchain’s fast and low-cost transaction capabilities
Who Is x402 For?
- Sellers: Service providers who want to monetize APIs or content. With minimal configuration, x402 enables direct, programmatic payments from clients.
- Buyers: Developers and AI agents who want to access paid services without registration flows or manual intervention.
Buyers and sellers interact directly through HTTP requests, while payments are executed transparently and automatically on-chain by the protocol.
What Can You Build?
x402 supports a wide range of use cases:
- Pay-per-request APIs
- AI agents capable of autonomously paying for APIs
- Digital content paywalls
- Microservices monetized via microtransactions
- API aggregation services that do not resell underlying capabilities
How It Works
At a high level, the workflow is straightforward:
- Request Initiated: The buyer requests a protected resource from the server.
- Payment Required: If payment is required, the server returns a
402 Payment Requiredresponse along with payment instructions. - Payment Submitted: The buyer generates and submits a signed payment payload.
- Payment Verified: The server calls the Facilitator’s
/verifyendpoint to validate the signed payload. - Settlement Executed: The server calls the Facilitator’s
/settleendpoint to submit the transaction on-chain. - Resource Delivered: Once settlement succeeds, the server delivers the requested resource.
To explore further:
Our goal is to build a low-barrier, permissionless, developer-friendly programmable commerce layer on blockchain.
Network Support
x402 currently supports the following networks:
- TRON Mainnet (
tron:0x2b6653dc) - TRON Shasta Testnet (
tron:0x94a9059e) - TRON Nile Testnet (
tron:0xcd8690dc) - BSC Mainnet (
eip155:56) - BSC Testnet (
eip155:97) - Base Mainnet (
eip155:8453)
Base Mainnet payments use official USDC with the exact scheme and EIP-3009 authorization.
SDK (TypeScript-only): x402 is a TypeScript-only SDK published as granular
@bankofai/x402-*npm packages (core,evm,tron,fetch,express,hono,fastify,next,axios,mcp,extensions). The source is maintained in a pnpm/turbo monorepo, but application development should install the published packages. Supported schemes:exact(ERC-3009 / Permit2),upto,batch-settlement, andexact_gasfree(TRON). The previous-generation Python + TypeScript SDK lives underlegacy/for reference. See the SDK Feature Matrix for the full breakdown.
Quick Start
Ready to build? Start here: