Skip to content

The x402 facilitator — how settlement happens

Last verified: 2026-05-29

TL;DR — zBase lets an x402 agent pay a provider from a privacy pool instead of sending a direct wallet-to-provider transfer. The current Base Sepolia flow supports exact-amount settlement and returns a reusable nextDeposit when a funded note has value left. The facilitator also derives a fresh ERC-5564 stealth address per call when the provider is registered.

For the architecture-level reasoning behind this design, read System architecture.

Latest verified run

Step Transaction
Deposit 0x3a44d0bccc8b714118faec6c392ad1bee63de541a77a884dff7b9a8c5ca1febf
Payment #1 0xfd0816d67a20c3a1f9fc4b64c3eca95ac9d3c870ba098f09daeb3a78541ca217
Payment #2 0xcadb0fc0da682a675e1d1787854c17fb82a745a9c71b28c607d3d041d3e39a4c

Run metrics:

  • Anonymity set reported by facilitator: 72
  • Settlement/proof times: 6212ms, 6144ms
  • Remaining value after payment #2: 89000

Sequence

sequenceDiagram
  autonumber
  participant A as Agent
  participant M as Paid API
  participant F as zBase Facilitator
  participant P as Base Sepolia Pool

  A->>M: Request paid endpoint
  M-->>A: HTTP 402 payment challenge
  A->>F: Verify zbaseDeposit and paymentDetails
  F-->>A: valid=true
  A->>F: Settle exact invoice amount
  F->>P: Relay Groth16 withdrawal
  P-->>F: txHash
  F-->>A: txHash and nextDeposit
  A->>M: Retry with settlement proof
  M-->>A: Paid response

API fields

Use zbaseDeposit in new integrations.

Settle request:

{
  "paymentDetails": {
    "payTo": "0xProviderAddress",
    "maxAmountRequired": "500000"
  },
  "zbaseDeposit": {
    "nullifier": "...",
    "secret": "...",
    "value": "1009800",
    "label": "...",
    "commitment": "..."
  }
}

Settle response:

{
  "settled": true,
  "txHash": "0x...",
  "amount": "500000",
  "remainingValue": "509800",
  "nextDeposit": {
    "nullifier": "...",
    "secret": "...",
    "value": "509800",
    "label": "...",
    "commitment": "..."
  }
}

Save nextDeposit immediately. The original note is spent after settlement.

Boundaries

zBase does not claim full anonymity. The verified testnet claim is that the provider payment is settled from the pool, so the payer wallet does not appear as the sender in the provider-payment transaction.

The ASP and postman are centralized today. Base Sepolia is a testnet release, not a mainnet production release.

Next → Contracts reference