Start here: x402 for developers/builders: What are you building?
x402 supports different roles and deployment models. Choose the path that matches what you need.
Protect HTTP endpoints and charge per request without subscriptions, API keys, or custom billing systems.
Learn more ->
Consume x402-protected APIs and resources programmatically, with payments handled automatically.
Learn more ->
Deploy and control your own facilitator for custom pricing, policies, and settlement rules.
Learn more ->
Use existing tooling and reference implementations to integrate x402 quickly.
Learn more ->
Why Algorand is the best fit for x402 developers
x402 is payment-rail agnostic by design, but some networks fall short of its core requirements. Algorand stands out by delivering production-ready performance across key dimensions:
-
Deterministic finality that keeps verification inside synchronous HTTP flows.
-
Low transaction fees that make true micropayments viable.
-
Stablecoin support for predictable, per-request pricing.
-
Reliable performance for high-frequency, machine-to-machine traffic.
- Native atomic grouping to enable more complex payment instructions
These properties make Algorand a strong settlement layer for pay-per-use APIs and agent payments.
The roles in an x402 system
x402 separates responsibilities to keep systems modular and composable.
Merchant - the economic actor offering something of value.
The merchant defines pricing, payment terms, and access rules. In simple systems, the merchant and resource server may be the same entity. In more complex systems, they are often separate.
Resource server - the HTTP endpoint that is being protected gates access behind payment.
The resource server responds with HTTP 402 when payment is required and serves the resource once payment is verified.
Facilitator - the coordination layer between HTTP services and the payment rail.
The facilitator verifies settlement, enforces pricing and access rules, and prevents replay or double-spend attempts.
This separation allows applications to stay focused on their core logic while payments remain abstracted.
How the x402 request flow works
At a protocol level, x402 follows a predictable pattern:
- A client or agent requests a protected resource.
- The server responds with HTTP 402 and structured payment requirements.
- The client submits payment proof.
- The facilitator verifies settlement.
- The server returns the requested resource.
When a resource requires payment, the server responds with HTTP 402 Payment Required. The client fulfills the payment requirement and retries the request. Settlement and verification happen behind the scenes, keeping the flow web-native and synchronous.
For a deeper conceptual discussion, read our x402 blog post.
Choosing a facilitator model
Facilitators are a core part of x402, and how you deploy them depends on your needs.
Self-hosted facilitator
-
Full control over verification and pricing logic
-
Custom policies and settlement rules
-
Greater operational responsibility
Shared or managed facilitator
-
Faster time to integration
-
Less infrastructure to maintain
-
Opinionated defaults
You can start with a managed setup and move to a self-hosted facilitator as your requirements evolve.
Common x402 developer use cases
Algorand is x402-ready. The network’s low fees, instant finality, and stablecoin support make it possible to support high-frequency, pay-per-use payment traffic without breaking real-time request flows.
Pay-per-API access
Charge per request without managing plans or quotas.
Agent-to-service payments
Allow AI agents to discover services and pay for usage autonomously.
On-demand compute and inference
Meter and charge for execution time or inference requests.
Premium data and content APIs
Sell access to high-value data without subscriptions.
Internal service monetization
Enable usage-based billing and cost attribution across microservices.
Developer resources by intent
Explore the Algorand Multichain Facilitator with Bazaar integration:
- Algorand Facilitator ->
- Algorand Facilitator OpenAPI docs ->
- Algorand Facilitator-supported networks ->
Run your own facilitator using Algorand's exact specification:
Explore a live example:
Run an x402 backend middleware using Typescript:
- X402 ExpressJS server package -> and example code ->
- X402 Hono Server package -> and example code ->
Run x402 fullstack using Typescript:
Run x402 paywall UI using Typescript:
Run x402 clients using Typescript:
- X402 Fetch client package -> and example code ->
- X402 Axios client package -> and example code ->
Use only x402 core and avm mechanisms in Typescript:
- X402 Core package -> and example code ->
- X402 AVM mechanism package -> and example code ->
Use x402 Bazaar extension in Typescript:
Run x402 Core functionality in Python:
Run x402 Backend servers in Python:
- X402 FastAPI package -> and example code ->
- X402 Flask package -> and example code ->
Run x402 Frontend clients in Python:
- X402 httpx package -> and example code ->
- X402 Requests package -> and example code ->
Use the x402 Bazaar extension in Python:
Keep engaged with x402
Ready to build? Explore reference implementations, test against live endpoints, or talk to our team about your use case.
Experience x402 in action
DISCLAIMER: The content provided in this page is for informational purposes only. The information is provided by the Algorand Foundation and while we strive to keep the information up-to-date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability, or availability with respect to the blog or the information, products, services, or related graphics contained in the blog for any purpose. The content of this blog is not intended to be legal, financial, or investment advice nor is it an endorsement, guarantee, or investment recommendation. You should not take any action before conducting your own research or consulting with a qualified professional. Any reliance you place on such information is therefore strictly at your own risk. All companies are independent entities solely responsible for their operations, marketing, and compliance with applicable laws and regulations. In no event will Algorand Foundation nor any affiliates be liable for any loss or damage including without limitation, indirect, or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this blog. Through this blog, you may be able to link to other websites which are not under the control of the Algorand Foundation. We have no control over the nature, content, and availability of those sites. The inclusion of any links does not imply a recommendation nor endorse the views expressed therein.