Self-hosted x402 facilitator.
x402-sovereign is a growing TypeScript project in the AI payments / x402 ecosystem. It currently has 63 GitHub stars and 15 forks.
@x402-sovereign/coreSelf-hosted x402 facilitator.
This package lets an API seller run their own x402 facilitator instead of pointing paymentMiddleware at Coinbase.
When you run this, you become the thing that:
/supported)/verify)/settle)No external facilitator. No Coinbase account. Your own infra.
Drop-in replacement for Coinbase’s facilitator URL
You point paymentMiddleware at your server instead of theirs.
EVM-only for now (Base / Base Sepolia etc.)
Framework adapters included
Built-in adapters for Hono and Express. Or use the framework-agnostic core with any HTTP server.
With Hono:
import { Hono } from "hono";
import { Facilitator, createHonoAdapter } from "@x402-sovereign/core";
import { baseSepolia } from "viem/chains";
const app = new Hono();
const facilitator = new Facilitator({
evmPrivateKey: process.env.EVM_PRIVATE_KEY as `0x${string}`,
networks: [baseSepolia],
});
// Mounts GET /facilitator/supported, POST /facilitator/verify, POST /facilitator/settle
createHonoAdapter(facilitator, app, "/facilitator");
With Express:
import express from "express";
import { Facilitator, createExpressAdapter } from "@x402-sovereign/core";
import { baseSepolia } from "viem/chains";
const app = express();
app.use(express.json());
const facilitator = new Facilitator({
evmPrivateKey: process.env.EVM_PRIVATE_KEY as `0x${string}`,
networks: [baseSepolia],
});
// Mounts GET /facilitator/supported, POST /facilitator/verify, POST /facilitator/settle
createExpressAdapter(facilitator, app, "/facilitator");
import { Facilitator } from "@x402-sovereign/core";
import { baseSepolia } from "viem/chains";
const facilitator = new Facilitator({
evmPrivateKey: process.env.EVM_PRIVATE_KEY as `0x${string}`,
networks: [baseSepolia],
});
// Expose three routes in your server:
// GET /supported
facilitator.listSupportedKinds()
// POST /verify { paymentPayload, paymentRequirements }
await facilitator.verifyPayment(paymentPayload, paymentRequirements)
// POST /settle { paymentPayload, paymentRequirements }
await facilitator.settlePayment(paymentPayload, paymentRequirements)
Then configure paymentMiddleware with your own facilitator URL:
paymentMiddleware(
"0xYourReceivingAddress",
{
"/protected-route": {
price: "$0.10",
network: "base-sepolia",
config: { description: "Premium content" },
},
},
{
url: "http://localhost:3000/facilitator",
}
);
After that:
/protected-route see the normal x402 payment flownew Facilitator({ evmPrivateKey, networks, minConfirmations? })evmPrivateKey: EVM private key used to settle payments (this account pays gas and receives funds)networks: array of viem Chain objects you want to support (e.g. baseSepolia)minConfirmations (optional): planned, not enforced yetlistSupportedKinds(): { kinds: { x402Version: 1; scheme: "exact"; network: string; }[] }Used for /supported.
verifyPayment(paymentPayload, paymentRequirements)Calls x402’s verify(...) under the hood.
Returns { valid: boolean } (is the buyer’s signed intent acceptable).
Used for /verify.
settlePayment(paymentPayload, paymentRequirements)Calls x402’s settle(...) under the hood.
Broadcasts the settlement tx on-chain using your key.
Returns { settled: boolean; txHash?: string }.
Used for /settle.
evmPrivateKey) is hot. Treat this like a hot wallet.Built-in adapters are available for popular frameworks. See ADAPTERS.md for details:
createHonoAdapter(facilitator, app, basePath)createExpressAdapter(facilitator, router, basePath)facilitator.handleRequest() for any other framework./example-hono/./packages/example-express/That's the whole point of this repo. You own the facilitator.
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
A payments protocol for the internet. Built on HTTP.
A local-first AI agent with persistent memory, emotional intelligence, and a peer-to-peer skills economy.
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.
Self-healing infrastructure for AI agent payments. 90.3% auto-recovery.
The AI agent with a wallet — spends USDC autonomously to get real work done. Apache-2.0, TypeScript.