Payment Flow
The facilitator enables seamless payment processing through a well-defined sequence of API calls between the client, resource server, and facilitator.1
Client Requests Resource
A client makes a request to a protected API endpoint without a payment header.
2
Resource Server Calls /accepts
The resource server middleware calls the facilitator’s
/accepts endpoint with partial payment requirements:- Scheme (e.g.,
exact) - Network (e.g.,
solana-devnet,base-sepolia) - Asset (token mint/contract address)
- Amount, recipient, resource URL
- Solana: Fee payer address, token decimals, recent blockhash
- EVM: EIP-712 domain parameters (name, version, chainId, verifyingContract)
3
Server Returns 402 Payment Required
The resource server returns a 402 status with the enriched payment requirements in the response body.
4
Client Prepares Payment
The client creates a payment proof based on the requirements:
- Solana: Creates and partially signs a transaction that transfers tokens to the merchant
- EVM: Signs an EIP-3009 authorization using EIP-712 typed data
5
Client Retries with Payment Header
The client retries the request with an
X-PAYMENT header containing the base64-encoded payment payload.6
Resource Server Calls /settle
The middleware calls the facilitator’s
/settle endpoint with:- The payment header from the client
- The original payment requirements
- Solana: Verifies the transaction, co-signs as fee payer, submits to blockchain
- EVM: Verifies the authorization signature, calls the token contract, pays gas
7
Facilitator Returns Transaction Hash
On success, the facilitator returns:
success: truetxHash: The blockchain transaction hashnetworkId: The network identifier
8
Resource Delivered
The resource server allows the request through and returns the protected resource to the client.
Sequence Diagram
Key Interactions
Resource Server ↔ Facilitator
The resource server makes two API calls to the facilitator:- POST /accepts - Retrieves enriched payment requirements before returning 402 to client
- POST /settle - Validates and executes payment after receiving client’s payment proof
- Hold cryptocurrency or private keys
- Understand blockchain transaction formats
- Interact with blockchain RPC endpoints
- Manage gas fees or transaction signing
Client ↔ Facilitator
The client doesn’t directly communicate with the facilitator. All interaction happens through:- The 402 response body (containing enriched requirements from facilitator)
- The X-PAYMENT request header (containing payment proof for facilitator)
Facilitator ↔ Blockchain
The facilitator handles all transaction settlement with blockchain networks:- Solana: Co-signs transactions as fee payer and submits to Solana RPC
- EVM: Calls
transferWithAuthorizationon token contracts and pays gas