Client = the HTTP requester (buyer, agent, bot).
Server = the HTTP responder (seller, API, service provider).
Client (Buyer)
The client initiates requests to b402-enabled endpoints. Clients include:- AI agents operating autonomously with their own wallets
- Applications making programmatic payments
- Scripts and bots consuming paid APIs
What the Client Does
- Sends request to a b402-enabled endpoint
- Receives
402with payment requirements (amount, token, recipient) - Signs EIP-712 payload authorizing the token transfer
- Resends request with
X-PAYMENTheader containing the signed payload - Receives resource along with settlement confirmation in
X-PAYMENT-RESPONSE
Client Code Example
Server (Seller)
The server provides resources behind a payment gate. Servers include:- API endpoints, data feeds, compute services
- Content providers and paywalled resources
- Any HTTP service that wants to charge per-request
What the Server Does
- Receives request from a client
- Returns
402 Payment Requiredif no valid payment is attached - Forwards payment to the facilitator’s
/verifyendpoint - Calls
/settleto execute the on-chain transfer - Serves the resource once settlement is confirmed
Server Code Example
Using the Facilitator API directly:Communication Flow
Two Payment Models
b402 supports two wallet types, each with a different settlement mechanism:EOA (Externally Owned Account)
- Standard Ethereum wallet (MetaMask, private key)
- Client signs EIP-712 payload
- Facilitator calls
transferWithAuthorization()on the Relayer contract - Requires prior token approval for the Relayer
Smart Wallet (ERC-7579 Nexus)
- Deterministic smart contract wallet deployed per-user
- Client signs a UserOperation hash
- Facilitator submits to ERC-4337 bundler with paymaster sponsorship
- No prior approval needed (batched in the UserOp)
- Gasless for the user
