Skip to main content

Overview

Returns enriched payment requirements with facilitator-specific details for resource servers. Endpoint: POST https://facilitator.corbits.dev/accepts

Purpose

This endpoint is called by resource server middleware when handling an initial request (before payment). The facilitator receives partially-filled payment requirements and enriches them with blockchain-specific parameters needed for clients to construct valid payment proofs.

Request Body

x402Version
number
required
The x402 protocol version. Currently 1.
accepts
array
required
Array of payment requirements to be enriched.

Response

x402Version
number
The x402 protocol version. Returns 1.
accepts
array
Array of enriched payment requirements that the facilitator can handle.

Example Request (Solana)

{
  "x402Version": 1,
  "accepts": [
    {
      "scheme": "exact",
      "network": "solana-devnet",
      "maxAmountRequired": "1000000",
      "resource": "https://api.example.com/data",
      "description": "API access fee",
      "mimeType": "application/json",
      "payTo": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
      "maxTimeoutSeconds": 300,
      "asset": "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"
    }
  ]
}

Example Response (Solana)

{
  "x402Version": 1,
  "accepts": [
    {
      "scheme": "exact",
      "network": "solana-devnet",
      "maxAmountRequired": "1000000",
      "resource": "https://api.example.com/data",
      "description": "API access fee",
      "mimeType": "application/json",
      "payTo": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
      "maxTimeoutSeconds": 300,
      "asset": "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",
      "extra": {
        "feePayer": "FacilitatorPublicKey123...",
        "decimals": 6,
        "recentBlockhash": "4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ..."
      }
    }
  ]
}

Example Request (EVM)

{
  "x402Version": 1,
  "accepts": [
    {
      "scheme": "exact",
      "network": "base-sepolia",
      "maxAmountRequired": "1000000",
      "resource": "https://api.example.com/data",
      "description": "API access fee",
      "mimeType": "application/json",
      "payTo": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "maxTimeoutSeconds": 300,
      "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
    }
  ]
}

Example Response (EVM)

{
  "x402Version": 1,
  "accepts": [
    {
      "scheme": "exact",
      "network": "base-sepolia",
      "maxAmountRequired": "1000000",
      "resource": "https://api.example.com/data",
      "description": "API access fee",
      "mimeType": "application/json",
      "payTo": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "maxTimeoutSeconds": 300,
      "asset": "0x036cbd53842c5426634e7929541ec2318f3dcf7e",
      "extra": {
        "name": "USDC",
        "version": "2",
        "chainId": 84532,
        "verifyingContract": "0x036cbd53842c5426634e7929541ec2318f3dcf7e"
      }
    }
  ]
}

Usage in Middleware

Resource servers typically call this endpoint through middleware:
import { createMiddleware } from '@faremeter/middleware/express';
import { x402Exact } from '@faremeter/info/solana';

app.get(
  '/protected',
  await createMiddleware({
    facilitatorURL: 'https://facilitator.corbits.dev',
    accepts: [
      x402Exact({
        network: 'devnet',
        asset: 'USDC',
        amount: '10000', // 0.01 USDC
        payTo: merchantAddress,
      }),
    ],
  }),
  (_, res) => {
    res.json({ data: protectedData });
  }
);

Handler Behavior

When the facilitator receives an /accepts request:
  1. Iterates through handlers: Each registered handler’s getRequirements() method is called
  2. Filters by scheme/network: Handlers only process requirements they support
  3. Enriches requirements: Matching handlers add blockchain-specific data to the extra field
  4. Aggregates results: All enriched requirements are combined and returned

When No Handlers Match

If no handlers match a requirement (unsupported scheme/network/asset combination), it won’t appear in the response. The facilitator returns an empty accepts array. Example - Unsupported Network: Request:
{
  "x402Version": 1,
  "accepts": [
    {
      "scheme": "exact",
      "network": "ethereum-mainnet",
      "maxAmountRequired": "1000000",
      "resource": "https://api.example.com/data",
      "description": "API access fee",
      "mimeType": "application/json",
      "payTo": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "maxTimeoutSeconds": 300,
      "asset": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
    }
  ]
}
Response (no matching handlers):
{
  "x402Version": 1,
  "accepts": []
}
This indicates the facilitator cannot handle payments on ethereum-mainnet. The client should try a different network or use a different facilitator.

Error Responses

400 Bad Request
Invalid request format, missing required fields, or malformed JSON.Example:
{
  "error": "Invalid request: missing required field 'accepts'"
}
500 Internal Server Error
Facilitator encountered an internal error (blockchain RPC failure, handler timeout, etc.).Example:
{
  "error": "Handler timeout"
}

See Also