https://facilitator.corbits.dev). If you need to run your own, use @faremeter/facilitator.
When to run your own
- You need to support custom payment schemes not available on the Corbits facilitator.
- You want full control over payment verification and settlement.
- You are running in an environment that cannot reach the Corbits facilitator.
Basic setup
createFacilitatorRoutes returns a Hono router with the standard facilitator endpoints: /accepts, /verify, /settle, and /supported.
Creating handlers
Each chain has its owncreateFacilitatorHandler function that returns a FacilitatorHandler. Install the payment package for the chain you want to support.
Solana handler
createFacilitatorHandler(network, rpc, feePayerKeypair, mint, config?)
The optional config parameter accepts:
| Option | Type | Description |
|---|---|---|
maxRetries | number | Maximum retries for transaction submission. |
retryDelayMs | number | Delay between retries in milliseconds. |
maxPriorityFee | number | Maximum priority fee in lamports. |
features | object | Feature flags (e.g., enableSettlementAccounts). |
hooks | FacilitatorHooks[] | Lifecycle hooks for afterVerify and afterSettle. |
EVM handler
createFacilitatorHandler(chain, privateKey, assetNameOrInfo, opts?)
| Parameter | Type | Description |
|---|---|---|
chain | ChainInfoWithRPC | Object with id, name, and rpcUrl. |
privateKey | string | Hex-encoded private key for transaction submission. |
assetNameOrInfo | AssetNameOrContractInfo | Asset name (e.g., "USDC") or contract info object. |
opts | object | Optional. network (KnownX402Network) and transport (viem Transport). |
Multi-chain configuration
Wire handlers for each chain together and pass them tocreateFacilitatorRoutes:
FacilitatorHandler interface:
null for payment schemes they do not support, allowing the facilitator to route to the correct handler.
Environment configuration
Facilitator handlers typically need:- RPC endpoint URLs for each chain
- Private keys for transaction submission (the facilitator submits transactions on behalf of clients)
- Token contract addresses
Facilitator endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/accepts | POST | Enriches payment requirements with facilitator-specific fields. |
/verify | POST | Verifies a payment without settling. |
/settle | POST | Verifies and settles a payment on-chain. Returns transaction hash. |
/supported | GET | Lists supported schemes, networks, and assets. |
Further reading
- Facilitators concept — How facilitators fit into the x402 flow.
- Middleware Overview — How middleware connects to the facilitator.