Skip to content

x402 Facilitator

The SBC facilitator is a hosted service that verifies and settles x402 payments. It never holds funds — it receives a signed authorization from the payer and executes the on-chain transfer atomically.

Base URL: https://x402.stablecoin.xyz

Mainnet requires an API key (X-API-Key header). Get yours at dashboard.stablecoin.xyz. Testnet is open.


Using the SDK

FacilitatorClient is the SDK wrapper around the HTTP API. You rarely need to call it directly — x402Middleware and createX402Client use it internally — but it's useful for custom integrations.

import { FacilitatorClient } from '@stablecoin.xyz/x402'
 
const facilitator = new FacilitatorClient({
  apiKey: process.env.API_KEY,     // required for mainnet
  facilitatorUrl: 'https://x402.stablecoin.xyz',  // default
})
 
// verify without settling
const result = await facilitator.verify(paymentPayload, paymentRequirements)
// { isValid: true, payer: '0x...', invalidReason: null }
 
// verify + settle (executes on-chain transfer)
const settled = await facilitator.settle(paymentPayload, paymentRequirements)
// { success: true, transaction: '0xTxHash', network: 'eip155:8453', payer: '0x...' }

HTTP API

GET /supported

Returns supported networks and facilitator signer addresses. No auth required.

curl https://x402.stablecoin.xyz/supported
{
  "kinds": ["exact"],
  "networks": [
    "eip155:8453",
    "eip155:84532",
    "eip155:723",
    "eip155:72344",
    "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
  ],
  "signers": {
    "eip155:*": ["0xdeE710bB6a3b652C35B5cB74E7bdb03EE1F641E6"],
    "solana:*": ["2mSjKVjzRGXcipq3DdJCijbepugfNSJCN1yVN2tgdw5K"]
  }
}

POST /verify

Verifies a payment payload without executing it on-chain. Checks signature validity, amount, deadline, and payer balance.

Headers:
  • Content-Type: application/json
  • X-API-Key: sbc-... (mainnet only)
Request:
{
  "paymentPayload": {
    "x402Version": 2,
    "accepted": { "scheme": "exact", "network": "eip155:8453" },
    "payload": {
      "signature": "0x...",
      "authorization": {
        "from": "0xPayer",
        "to": "0xFacilitator",
        "value": "1000000000000000",
        "validAfter": "0",
        "validBefore": "1700000000",
        "nonce": "0"
      }
    }
  },
  "paymentRequirements": {
    "scheme": "exact",
    "network": "eip155:8453",
    "maxAmountRequired": "1000000000000000",
    "asset": "0xfdcC3dd6671eaB0709A4C0f3F53De9a333d80798",
    "payTo": "0xMerchant",
    "maxTimeoutSeconds": 300,
    "extra": { "name": "Stable Coin", "version": "1" }
  }
}
Response:
{ "isValid": true, "payer": "0xPayer", "invalidReason": null }

POST /settle

Executes the on-chain transfer. For EVM: calls permit() + transferFrom(). For Solana: executes the delegated SPL transfer.

Same request format as /verify. Response:

{
  "success": true,
  "transaction": "0xTxHash",
  "network": "eip155:8453",
  "payer": "0xPayer"
}

GET /health

curl https://x402.stablecoin.xyz/health
# {"status":"ok","service":"SBC x402 Facilitator"}

Network Reference

NetworkCAIP-2StatusDecimalsSBC Token
Baseeip155:8453Mainnet180xfdcC3dd6671eaB0709A4C0f3F53De9a333d80798
Base Sepoliaeip155:84532Testnet (free)60xf9FB20B8E097904f0aB7d12e9DbeE88f2dcd0F16
Radiuseip155:723Mainnet60x33ad9e4bd16b69b5bfded37d8b5d9ff9aba014fb
Radius Testneteip155:72344Testnet (free)60x33ad9e4bd16b69b5bfded37d8b5d9ff9aba014fb
Solanasolana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpMainnet9DBAzBUXaLj1qANCseUPZz4sp9F8d2sc78C4vKjhbTGMA

Active mainnet networks (base, radius, solana) require an API key. Testnet networks are open.


Payment Mechanisms

EVM — ERC-2612 Permit

The payer signs an off-chain EIP-712 Permit message authorizing the facilitator to transfer SBC on their behalf. The payer pays no gas.

The facilitator calls:

  1. token.permit(owner, spender, value, deadline, v, r, s)
  2. token.transferFrom(owner, payTo, value)

Both happen atomically in a single transaction. The facilitator pays the gas.

Solana — Delegated SPL Transfer

The payer signs an off-chain Ed25519 message with the format:

from:{from}|to:{to}|amount:{amount}|nonce:{nonce}|deadline:{deadline}

The facilitator executes token.transferChecked() using a pre-approved SPL token delegation.

One-time setup required per payer wallet. The payer must approve the facilitator address as a delegate for their SBC token account:

# using @solana/spl-token CLI
spl-token approve \
  <YOUR_SBC_TOKEN_ACCOUNT> \
  <AMOUNT> \
  2mSjKVjzRGXcipq3DdJCijbepugfNSJCN1yVN2tgdw5K

Or programmatically using the SDK example:

# in examples/solana-demo/
cp .env.example .env   # add SOLANA_PRIVATE_KEY
pnpm approve           # runs approve-delegate.ts once

The facilitator address is 2mSjKVjzRGXcipq3DdJCijbepugfNSJCN1yVN2tgdw5K.


Self-Hosting

The facilitator is open source: github.com/stablecoinxyz/x402-facilitator

git clone https://github.com/stablecoinxyz/x402-facilitator
cp .env.example .env
npm install
npm run dev

Key environment variables:

VariableDescription
EVM_PRIVATE_KEYFacilitator signer key for EVM networks
SOLANA_PRIVATE_KEYFacilitator signer key for Solana
DASHBOARD_URLAPI key validation endpoint (default: https://dashboard.stablecoin.xyz)
ENABLE_API_KEY_GATINGSet false to disable API key requirement (default: true)
PORTServer port (default: 3000)

x402 v2 compatibility: 36/36 spec checks passing. See COMPATIBILITY.md.