


x402 internet-native protocol for Algorand Blockchain
Built by Coinbase around the HTTP 402 status code, x402 protocol enables users to pay for resources via API without registration, emails, OAuth, or complex signatures. Algorand support is provided by Algorand Foundation & GoPlausible.
x402 as a protocol has 0 fees for either the customer or the merchant.
Accept payments at the speed of the blockchain. Money in your wallet in 2 seconds, not T+2.
x402 is not tied to any specific blockchain or token, its a neutral standard open to integration by all.
As little as 1 line of middleware code or configuration in your existing web server stack and you can start accepting payments. Customers and agents aren't required to create an account or provide any personal information.
Anyone can implement or extend x402. It's not tied to any centralized provider, and encourages broad community participation.
Activates the dormant 402 HTTP status code and works with any HTTP stack. It works simply via headers and status codes on your existing HTTP server.
x402 unlocks new monetization models, offering developers and content creators a frictionless way to earn revenue from small transactions without forcing subscriptions or showing ads.
Agents can use the x402 Protocol to pay for API requests in real-time.
Using x402, customers can easily access storage services without account creation.
x402 unlocks instant transactions, enabling true micropayments for content.
Real-time, low-fee processing that makes high-volume, fractional-cent pricing economically viable.
High-velocity payments between automated systems (e.g., IOT), enabling devices and services to independently exchange value.
Autonomous software agents can initiate, negotiate, and settle transactions programmatically, enabling commerce between intelligent systems without human intervention.
Autonomous agents can unlock metered access to premium content, media, data, or services, billed per use instead of fixed subscriptions.
Autonomous subscription payment renewals executed by agents on behalf of users.
Replace API keys, subscription tiers, and quota management with programmable payment per request.
x402 allows any web developer to accept crypto payments without the complexity of having to interact with the blockchain.
For a payment-requiring endpoint or resource (URL), if a request arrives without payment, the server responds with HTTP 402, prompting the client that payment is required, accompanied by payment requirements information.
HTTP/1.1 402 Payment Required
The client then constructs a payment transaction for the required amount and sends it back to the server in the X-PAYMENT request header.
The server forwards the payment to a facilitator, which verifies and settles it on the Algorand blockchain, then signals back to the server with the results.
Finally, the server validates the payment results and, if successful, serves the original request with a 200 OK response along with the requested resource.
HTTP/1.1 200 OK
Algorand x402 Main Resources:
x402 Algorand TypeScript Packages (npm):
x402 Algorand Python Package (pip):
TypeScript Code Examples:
Core and Mechanism Examples:
Extensions and Paywall Examples:
Back-end Framework-Specific Middleware Examples:
Fullstack Framework-Specific Examples:
HTTP Client Examples:
Python Code Examples:
Core and Mechanism Examples:
Extensions Examples:
Back-end Framework-Specific Middleware Examples:
HTTP Client Examples:
x402 protocol comes with exact specifications for each blockchain virtual machine type, EVM, AVM, SVM, as well as a core package and per-framework integration packages published as scoped npm packages and a Python package on PyPI.
npm install @x402-avm/core @x402-avm/avm // Core protocol + Algorand mechanism
Built atop @x402-avm/core, integration packages exist for the most popular backend and frontend frameworks: Express, Hono, Next.js, Fetch, and Axios.
Backends and SSR:
npm install @x402-avm/express // x402 payment middleware for Express.js
npm install @x402-avm/hono // x402 payment middleware for Hono (Cloudflare Workers, Deno)
npm install @x402-avm/next // x402 payment middleware for Next.js (App Router)
Frontends and clients:
npm install @x402-avm/fetch // x402 client wrapper for the Fetch API
npm install @x402-avm/axios // x402 client wrapper for Axios
Python:
pip install "x402-avm[avm,fastapi]" // Python package with extras: [avm], [fastapi], [flask], [httpx], [requests], [extensions], [all]
