Ӿ402Nano Facilitator
This facilitator verifies and settles x402 payments on the Nano network. Point any x402-compatible resource server at https://x402nano.org/facilitator and start accepting feeless payments — no account required.
Quick Start
Start accepting Nano payments in minutes. No account required — the facilitator works out of the box.
- 1
No signup needed
The facilitator is permissionless. Start using it immediately — no account, no API key.
- 2
Install the SDK
Use
@x402/nextfor built-in Next.js middleware and route handler support, or@x402/corefor manual verify/settle in any server framework. - 3
Verify, settle, serve
When a client sends a payment signature, forward it to the facilitator for verification and on-chain settlement. Optionally create an account later for usage analytics.
FACILITATOR_URL=https://x402nano.org/facilitatorPayment Flow
The x402 protocol adds a payment layer to standard HTTP requests. Here is the full flow for a Nano payment:
- 1
Client requests a protected resource
The client makes a standard HTTP request to your API endpoint.
- 2
Server returns 402 Payment Required
The response includes a
PAYMENT-REQUIREDheader containing the Base64-encoded payment requirements: accepted schemes, price, network and the recipient Nano address. - 3
Client signs a Nano block and computes PoW
The client constructs a Nano send block for the specified amount to the recipient address, signs it with its private key, and generates proof of work.
- 4
Client retries with payment signature
The client retries the original request with the Base64-encoded payment payload in the
PAYMENT-SIGNATUREheader. - 5
Server verifies and settles via facilitator
Your server forwards the payment payload to this facilitator. The facilitator validates the signed block and broadcasts it to the Nano network for settlement. The outcome is returned in the
PAYMENT-RESPONSEheader. Once confirmed, your server serves the protected content.
SDK Reference
Use @x402/next for first-class Next.js integration with middleware and route handler support, or @x402/core for manual verify/settle in any server framework.
@x402/next (Next.js Integration)
The official Next.js package provides paymentProxy for protecting page routes via middleware and withX402 for wrapping API route handlers. Settlement only happens after a successful response, so clients are never charged for failed requests.
npm install @x402/next @x402/coreproxy.ts in your project root. The middleware intercepts matching routes and returns 402 Payment Required until the client pays.import { paymentProxy, x402ResourceServer } from '@x402/next'import { HTTPFacilitatorClient } from '@x402/core/server'
const facilitator = new HTTPFacilitatorClient({ url: 'https://x402nano.org/facilitator',})const server = new x402ResourceServer(facilitator)
export const proxy = paymentProxy( { '/premium': { accepts: { scheme: 'exact', network: 'nano:mainnet', price: '0.001', payTo: 'nano_1your_address_here', }, description: 'Access to premium content', }, }, server,)
export const config = { matcher: ['/premium/:path*'],}withX402. Payment is only settled after the handler returns a successful response.// app/api/ai-chat/route.tsimport { NextRequest, NextResponse } from 'next/server'import { withX402 } from '@x402/next'
const handler = async (req: NextRequest) => { // Your API logic return NextResponse.json({ message: 'Hello from paid API' })}
export const POST = withX402( handler, { accepts: { scheme: 'exact', network: 'nano:mainnet', price: '0.0001', payTo: 'nano_1your_address_here', }, description: 'AI chat completion', }, server, // your configured x402ResourceServer)@x402/core (Manual Integration)
For non-Next.js servers or when you need full control over the payment flow, use HTTPFacilitatorClient directly.
npm install @x402/coreimport { HTTPFacilitatorClient } from '@x402/core/server'
const facilitator = new HTTPFacilitatorClient({ url: 'https://x402nano.org/facilitator'})No API key needed in the constructor. Optionally pass one via HTTP headers for analytics (see Authentication).
const verifyResult = await facilitator.verify( paymentPayload, paymentRequirements,)
if (verifyResult.isValid) { const settleResult = await facilitator.settle(paymentPayload, paymentRequirements) if (settleResult.success) { // Payment settled — serve protected content }} else { // Payment invalid: verifyResult.invalidReason}// Express exampleapp.get('/api/data', async (req, res) => { const paymentPayload = req.headers['payment-signature'] if (!paymentPayload) { return res.status(402).json(paymentRequirements) }
const { isValid } = await facilitator.verify(paymentPayload, paymentRequirements) if (!isValid) return res.status(400).json({ error: 'Invalid payment' })
const { success } = await facilitator.settle(paymentPayload, paymentRequirements) if (!success) return res.status(500).json({ error: 'Settlement failed' })
res.json({ data: 'premium content' })})Authentication
API keys are optional. The facilitator works without authentication. Include an API key to enable usage analytics in your dashboard.
Option 1: x-api-key header
x-api-key: x402n_your_api_key_hereOption 2: Authorization header
Authorization: Bearer x402n_your_api_key_hereAI Agents
x402 was designed with machine-to-machine payments in mind. An AI agent can autonomously discover, pay for, and consume API endpoints without human intervention.
When an AI agent calls your x402-protected endpoint, it receives a 402 Payment Required response containing the Base64-encoded PAYMENT-REQUIRED header with the payment details, payment amount, recipient Nano address, and network identifier.
The agent constructs a Nano send block for the specified amount, signs it with its private key, generates proof of work, and retries the request with the Base64-encoded payment payload in the PAYMENT-SIGNATURE header.
Your server extracts the payment signature and forwards it to this facilitator via /facilitator/verify and /facilitator/settle. The facilitator validates the block signature and broadcasts it to the Nano network. Once settled, your server serves the protected content.
Rate Limits
To ensure fair usage and protect the network, the following rate limits apply per IP address:
| Endpoint | Limit | Window |
|---|---|---|
| /facilitator/verify | 200 requests | per minute |
| /facilitator/settle | 200 requests | per minute |
Error Handling
All errors return a consistent JSON format. Check the HTTP status code and message for debugging.
400 Bad Request
Missing or invalid JSON body. Check your request format.
401 Unauthorized
The API key provided is invalid. If you don't need analytics, omit the key entirely.
429 Too Many Requests
Rate limit exceeded. Wait and retry after the limit window resets.
500 Internal Server Error
Something went wrong on our end. Check the dashboard for incident status.