X-PAYMENT header (v1) or PAYMENT-SIGNATURE header (v2).
Scheme identification
Every payment is identified by a tuple of three values:| Field | Example | Description |
|---|---|---|
scheme | "exact" | The payment method |
network | "solana-devnet" | The blockchain network |
asset | "USDC" | The token being used |
Solana schemes
SPL Token payments
The primary Solana scheme uses SPL token transfers for payments. The client signs a transaction transferring tokens from their wallet to the merchant’s address.Native SOL
Faremeter also supports native SOL transfers for Solana payments.Flex (prepaid escrow)
The@faremeter/flex scheme replaces per-request transactions with a prepaid escrow account and off-chain authorizations signed by a session key. The facilitator settles actual usage on-chain in batches after the work is done. This decouples service delivery from on-chain confirmation and is the right fit for variable-cost or high-frequency workloads (AI inference, streaming, metered APIs).
EVM schemes
EIP-3009 gasless transfers
The EVM scheme uses EIP-3009transferWithAuthorization for gasless USDC payments. The client signs an EIP-712 typed message authorizing the transfer. The facilitator submits the transaction on-chain and pays the gas fees.
How schemes compose
Faremeter’s plugin architecture allows multiple schemes to coexist. A server can accept both Solana and EVM payments simultaneously:Capture timing: one-phase vs two-phase
Independent of which scheme is used, a payment can settle in one phase or two. The middleware body callback exposes two operations —authorize() (reserve funds) and capture() (settle them) — and a handler’s capturesAt value decides when capture runs. See the Middleware Overview for the body API.
capturesAt | Phases | Body callback flow |
|---|---|---|
"request" | one-phase | calls capture() immediately |
"response" | two-phase | calls authorize() now, captures later |
"request"— one-phase. The body callscapture()immediately, so the payment clears before the resource is produced. This is the simplest path, with no deferred settlement."response"— two-phase. The body callsauthorize()now and defers capture to a later phase, once the final amount is known. The OpenAPI gateway, for example, captures at the/responsestep for usage-based pricing where the charge depends on a value in the response (such asusage.total_tokens).
capturesAt per request from the matched handler’s authorize capability and the rule’s hasAuthorize flag, so the body callback does not have to inspect the context to choose a path. Two-phase capture requires a handler that can authorize (one that supports handleVerify); a scheme that cannot authorize is one-phase only.
Adding new schemes
New payment schemes can be added through the payment handler interface. See Plugins for community-contributed schemes.Further reading
- Wallets & Signing — How wallets interact with payment schemes.
- Networks & Assets — Supported networks and tokens.