A fast x402 facilitator running on cloudflare workers
x402-facilitator is an early-stage TypeScript project in the AI payments / x402 ecosystem. It currently has 3 GitHub stars and 3 forks.
A high-performance and fast x402 payment facilitator deployed on Cloudflare's edge network, enabling USDC payments on Base using ERC-3009 TransferWithAuthorization.
This facilitator provides payment verification, settlement, and service discovery for the x402 protocol. Built on Cloudflare Workers, it offers low-latency responses with global distribution and automatic scaling.
verify, settle, discovery)
Use it as a template with:
npm create cloudflare@latest -- --template=0xkoda/x402-facilitator
Or
Clone and install dependencies:
git clone https://github.com/0xKoda/x402-facilitator.git
cd x402-facilitator
npm install
Create KV namespace for state management:
wrangler kv namespace create "NONCES"
Update wrangler.jsonc with your namespace IDs:
{
"kv_namespaces": [
{
"binding": "NONCES",
"id": "<production-id>"
}
]
}
Add your facilitator wallet private key:
wrangler secret put SIGNER_PRIVATE_KEY
Optional: Configure custom RPC endpoints in wrangler.jsonc:
{
"vars": {
"RPC_URL_BASE": "https://your-base-rpc.com",
"RPC_URL_BASE_SEPOLIA": "https://your-sepolia-rpc.com"
}
}
Deploy to Cloudflare Workers:
wrangler deploy
Your facilitator URL: https://<worker-name>.<subdomain>.workers.dev
Health check and capabilities endpoint.
Response:
{
"name": "x402 Facilitator",
"version": "1.0.0",
"status": "healthy",
"endpoints": {
"verify": "/verify",
"settle": "/settle",
"discovery": "/discovery/resources"
}
}
Validates payment authorization without on-chain settlement.
Request:
{
"x402Version": 1,
"paymentPayload": { ... },
"paymentRequirements": { ... }
}
Response:
{
"isValid": true,
"payer": "0x..."
}
Executes on-chain payment settlement.
Request:
{
"x402Version": 1,
"paymentPayload": { ... },
"paymentRequirements": { ... }
}
Response:
{
"success": true,
"transaction": "0x...",
"network": "base",
"payer": "0x..."
}
Lists all registered x402-compatible services.
Query parameters:
limit: Maximum results (default: 100, max: 1000)offset: Pagination offset (default: 0)Response:
{
"x402Version": 1,
"items": [
{
"resource": "https://api.example.com/endpoint",
"type": "http",
"accepts": [...],
"lastUpdated": "2025-01-28T00:00:00.000Z"
}
],
"pagination": {
"limit": 100,
"offset": 0,
"total": 42
}
}
Alias for /discovery/resources.
Sellers are automatically registered when their endpoints are used. Discovery catalog features:
The facilitator wallet requires ETH on Base for transaction gas:
Obtain testnet ETH: Coinbase Faucet or Base Sepolia Faucet
Check facilitator health:
curl https://your-facilitator.workers.dev/
View discovery catalog:
curl https://your-facilitator.workers.dev/discovery/resources
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
You are solely responsible for:
MIT
Production-ready x402 facilitator server.
Rust SDK for the x402 payment protocol.
Accept payments from AI agents. Open-source. Your data, your domain, your rules. Free forever.
A production-ready payment settlement service for the x402 protocol. Built with Elysia and Node.js, it verifies cryptographic payment signatures and settles transactions on-chain for EVM, SVM (Solana), and Starknet networks.
Golang implementation of an x402 payment facilitator
x402 payment facilitator — verifies and settles EIP-3009 USDC micropayments on Base, Arbitrum, and Ethereum.