Multi-chain x402 Facilitator by Infra402

Version: 0.0.3

Production-ready x402 facilitator with enhanced security features, abuse detection, rate limiting, and multi-chain support

Available Endpoints

GET / — API root
Response: This HTML page with endpoint documentation
GET /health — Health check
Response:
{
  "kinds": [
    { "version": "1.0", "scheme": "exact", "network": "base-sepolia" },
    { "version": "1.0", "scheme": "exact", "network": "base" },
    ...
  ]
}
GET /supported — Supported networks/schemes
Response: Same format as /health
POST /verify — Verify payment signatures
Request Body:
{
  "x402Version": 1,
  "paymentPayload": {
    "x402Version": 1,
    "scheme": "exact",
    "network": "<network>",
    "payload": {
      "signature": "0x...",           // 65-byte hex signature
      "authorization": {
        "from": "0x...",              // payer address
        "to": "0x...",                // recipient address
        "value": "1000000",           // amount in token units
        "validAfter": "0",            // unix timestamp
        "validBefore": "1735689600",  // unix timestamp
        "nonce": "0x..."              // 32-byte hex nonce
      }
    }
  },
  "paymentRequirements": {
    "scheme": "exact",
    "network": "<network>",
    "maxAmountRequired": "1000000",
    "resource": "https://example.com/api",
    "description": "API access",
    "mimeType": "application/json",
    "payTo": "0x...",
    "maxTimeoutSeconds": 300,
    "asset": "0x..."                  // token contract address
  }
}

Supported networks:
  EVM: base-sepolia, base, xdc, avalanche-fuji, avalanche,
       polygon-amoy, polygon, sei, sei-testnet, bsc, bsc-testnet
  Solana: solana, solana-devnet

Response (success):
{ "valid": true, "payer": "0x..." }

Response (failure):
{ "valid": false, "payer": "0x...", "reason": { "type": "InvalidSignature", "message": "..." } }
POST /settle — Submit payment to blockchain
Request Body: Same as POST /verify

Response (success):
{
  "success": true,
  "payer": "0x...",
  "transaction": "0xabc123...",       // transaction hash
  "network": "base-sepolia"
}

Response (failure):
{
  "success": false,
  "payer": "0x...",
  "errorReason": { "type": "InsufficientFunds", "message": "..." },
  "transaction": null,
  "network": "base-sepolia"
}
GET /admin/stats — Admin statistics (requires X-Admin-Key header)
Response:
{
  "abuse_detection": {
    "total_ips_tracked": 42,
    "suspicious_ips": 3
  },
  "batch_settlement": {
    "active_queues": 5
  }
}

Documentation: https://github.com/infra402/infra402-facilitator