Monetize your API with x402
x402 lets you monetize HTTP APIs and content with on-chain payments, while keeping your existing server stack. Benefits: β Customers donβt pay network fees.β Payment settles in < 1 second.
β Universal compatibility β if it speaks HTTP, it speaks x402.
Architecture at a glance
- Client: Calls your protected resource and submits payments.
- Server (merchant): Advertises payment requirements, verifies payments, fulfills requests, and settles payments.
- Facilitator: Verifies and/or settles payments on your behalf via standard endpoints.
- Blockchain: Where payments are executed and confirmed.
Itβs that easy
Add x402 payments to your server with just a few lines:- Express
- Hono
Getting started
Select one of the quickstart examples, or read the reference for more details.- TypeScript
- Python
Express
Quickstart for building an x402-enabled server with Express.
Hono
Quickstart for building an x402-enabled server with Hono.
Next.js
Quickstart for building an x402-enabled server with Next.js.
Facilitator setup
The@payai/facilitator package provides a pre-configured facilitator that connects to the PayAI facilitator at https://facilitator.payai.network:
PAYAI_API_KEY_ID and PAYAI_API_KEY_SECRET environment variables β see Going to Production. For details on how authentication works or to implement it without PayAI packages, see Facilitator Authentication.
x402 reference
For a deeper dive into message shapes, headers, verification and settlement responses, see the x402 Reference.Need help?
Join our Community
Have questions or want to connect with other developers? Join our Discord server.

