x402 nanopayments

How an EIP-3009 signature becomes a paid tool response.

Sendero uses x402 for direct HTTP tool calls. Each call is quoted, signed, settled, and executed independently.

Client -->  POST /tools/search_flights       { input }
Server <--  402 Payment Required             PAYMENT-REQUIRED: <base64 quote>
Client -->  POST /tools/search_flights       Payment-Signature: <base64 signed payment>
Server <--  200 OK                           { payment, result }

Step 1 - Quote

Call a paid tool without Payment-Signature:

curl -i -X POST https://edge.sendero.travel/tools/search_flights \
  -H "content-type: application/json" \
  -d '{
    "origin": "SFO",
    "destination": "LHR",
    "departureDate": "2026-06-11",
    "passengers": 1
  }'

The response is 402 Payment Required and includes a PAYMENT-REQUIRED header. Decode the base64 header to get the payment requirements:

{
  "x402Version": 2,
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:5042002",
      "asset": "0x3600000000000000000000000000000000000000",
      "amount": "2000",
      "payTo": "0x...",
      "description": "Sendero tool call: search_flights",
      "extra": {
        "name": "GatewayWalletBatched",
        "version": "1",
        "verifyingContract": "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"
      }
    }
  ]
}

Step 2 - Sign

Your wallet signs an EIP-3009 transferWithAuthorization payload for the quoted amount. Sendero's edge worker expects that signed payload as base64 JSON in the Payment-Signature header.

export BASE64_X402_PAYMENT="eyJ4NDAyVmVyc2lvbiI6Miwi..."

Step 3 - Retry

Retry the same tool call:

curl -X POST https://edge.sendero.travel/tools/search_flights \
  -H "content-type: application/json" \
  -H "Payment-Signature: $BASE64_X402_PAYMENT" \
  -d '{
    "origin": "SFO",
    "destination": "LHR",
    "departureDate": "2026-06-11",
    "passengers": 1
  }'

Sendero verifies and settles the payment with the Circle x402 batching facilitator, then runs the tool. If settlement fails, the tool does not run. If the tool throws before producing a result, the response is an error and the meter records the failed attempt separately.

Response

{
  "tool": "search_flights",
  "paid": true,
  "priceUsdc": "0.002",
  "payment": {
    "payer": "0x...",
    "amountUsdc": "0.002",
    "settlementTx": "0x..."
  },
  "result": {
    "offers": []
  }
}

MCP versus x402

MCP is for schema discovery and tool invocation by agent hosts. x402 is the direct HTTP payment interface. Production deployments can combine them at the gateway, but the current edge worker exposes them as separate surfaces:

  • POST /mcp for MCP JSON-RPC.
  • POST /tools/:name for x402-gated HTTP tool calls.

Why Arc

  • USDC is the settlement asset.
  • Testnet calls are cheap enough for high-frequency agent loops.
  • Each paid call leaves an auditable receipt that can be reconciled to tenant invoices.

On this page

x402 nanopayments