Payment Schemes
T402 supports multiple payment schemes to accommodate different billing models and use cases.
What is a Scheme?
A scheme defines how payments are authorized, verified, and settled. Each scheme specifies:
- Authorization format (how clients sign payment requests)
- Verification requirements (what the facilitator checks)
- Settlement mechanism (how funds are transferred on-chain)
Available Schemes
| Scheme | Description | Use Case |
|---|---|---|
exact | Fixed amount payments | One-time purchases, subscriptions |
upto | Usage-based billing | AI tokens, API calls, streaming |
Exact Scheme
The exact scheme transfers a fixed amount specified upfront.
{
"scheme": "exact",
"network": "eip155:8453",
"amount": "1000000",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"payTo": "0x..."
}Characteristics:
- Amount known before request
- Full amount transferred on settlement
- Simpler implementation
- Uses EIP-3009 TransferWithAuthorization (EVM)
Best for:
- Fixed-price API calls
- Content purchases
- Subscription payments
- Any scenario where cost is predetermined
Up-To Scheme
The upto scheme authorizes transfer of up to a maximum amount.
{
"scheme": "upto",
"network": "eip155:8453",
"maxAmount": "1000000",
"minAmount": "10000",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"payTo": "0x...",
"extra": {
"unit": "token",
"unitPrice": "100"
}
}Characteristics:
- Client authorizes maximum exposure
- Settlement based on actual usage
- Server tracks and reports consumption
- Uses EIP-2612 Permit (EVM)
Best for:
- LLM token generation
- Metered API usage
- Streaming content
- Compute resources
Learn more about the upto scheme →
Scheme Comparison
| Feature | exact | upto |
|---|---|---|
| Amount field | amount | maxAmount |
| Settlement | Fixed amount | Variable (≤ max) |
| Client risk | Exact cost known | Maximum exposure known |
| Server complexity | Lower | Higher (usage tracking) |
| EVM implementation | EIP-3009 | EIP-2612 + Router |
Choosing a Scheme
Use exact when:
- Price is known before the request
- Simple pay-per-call model
- Fixed content or service pricing
- Lower implementation overhead desired
Use upto when:
- Cost depends on request outcome
- Usage-based or metered billing
- Variable-length operations (streaming, generation)
- Partial refunds may be needed
Network Support
| Network | exact | upto |
|---|---|---|
| EVM (Base, Ethereum, Arbitrum, etc.) | ✅ EIP-3009 | ✅ EIP-2612 |
| Solana | ✅ SPL Transfer | — |
| TON | ✅ Jetton Transfer | — |
| TRON | ✅ TRC-20 Transfer | — |
| NEAR | ✅ NEP-141 Transfer | — |
| Aptos | ✅ Fungible Asset Transfer | — |
| Tezos | ✅ FA2 Transfer | — |
| Polkadot | ✅ assets.transfer | — |
| Stacks | ✅ SIP-010 Transfer | — |
| Cosmos (Noble) | ✅ Bank MsgSend | — |
SDK Support
All T402 SDKs support both schemes:
// TypeScript - exact scheme
import { ExactEvmScheme } from '@t402/evm';
// TypeScript - upto scheme
import { UptoEvmScheme } from '@t402/evm';# Python - exact scheme
from t402.schemes import ExactEvmClientScheme
# Python - upto scheme
from t402.schemes import UptoEvmClientScheme// Go - exact scheme
import "github.com/t402-io/t402/sdks/go/mechanisms/evm/exact"
// Go - upto scheme
import "github.com/t402-io/t402/sdks/go/mechanisms/evm/upto"// Java - exact scheme
import io.t402.model.ExactSchemePayload;
// Java - upto scheme
import io.t402.schemes.upto.UptoPaymentRequirements;
import io.t402.schemes.evm.upto.UptoEIP2612Payload;