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 the TRON and BSC networks, 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-*](https://www.npmjs.com/package/@bankofai/x402-tron) packages in your TypeScript app. The
[ships runnable client → server → facilitator examples under](https://github.com/BofAI/x402)
x402
repositoryexamples/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 channelsPoor 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 APIsAI agents capable of autonomously paying for APIsDigital content paywallsMicroservices monetized via microtransactionsAPI 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 a402 Payment Required
response along with payment instructions.Payment Submitted: The buyer generates and submits a signed payment payload.Verification & Settlement: The server calls the x402 Facilitator’s/verify
and/settle
endpoints to validate and settle the payment.Resource Delivered: Once verification 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:mainnet`
)**TRON Shasta Testnet**(`tron:shasta`
)**TRON Nile Testnet**(`tron:nile`
)**BSC Mainnet**(`eip155:56`
)**BSC Testnet**(`eip155:97`
)
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
,auth-capture
(EVM), 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: