Architecture Overview
Faremeter separates concerns into two main components:- Wallet packages - Handle wallet creation, key management, and transaction signing
- Payment packages - Handle payment logic, x402 protocol, and transaction construction
Understanding Wallet Interfaces
EVM Wallet Interface
For EVM chains (Ethereum, Base, etc.), wallets must implement this interface:EIP-712 Signing Details (Advanced)
EIP-712 Signing Details (Advanced)
When your wallet’s Types:Message:The signature must follow EIP-712 exactly - the USDC contract will verify that the signature recovers to the 
signTypedData is called, it will receive this structure:Domain:from address. This is why smart wallets cannot use this scheme (they don’t have an EOA private key for signature recovery).Note on Chain Types: If you’re using viem’s 
Chain type (from viem/chains), it already includes id and name fields along with many others. The payment handler only uses id and name, so you can pass a full Chain object directly - the extra fields will be ignored.Solana Wallet Interface
For Solana, wallets must implement this interface:Which methods should I implement?
Which methods should I implement?
All three methods are optional. Choose which to implement based on your wallet’s capabilities:
updateTransaction only (most common)- Use when: Your wallet just needs to sign transactions
- The payment handler builds the transaction automatically
- Examples: Phantom, local keypair wallets, hardware wallets
buildTransaction only- Use when: Your wallet needs complete control over transaction construction AND signing happens inside buildTransaction
- The payment handler lets you build everything, then sends the serialized transaction
- Example: Squads multisig (builds with vault PDA as payer, coordinates proposals/approvals, signs within buildTransaction)
buildTransaction + updateTransaction- Use when: You need custom transaction construction but signing is separate
- buildTransaction creates the tx structure, updateTransaction adds signatures
- Example: Custom fee payer pattern (see Solana Example 3 below)
sendTransaction only- Use when: The wallet SDK doesn’t expose signed transactions or RPC access - it handles everything internally and only returns a hash
- Why: Custodial/smart wallet SDKs (like Crossmint) manage their own RPC endpoints and transaction broadcasting
- The payment handler just gets back a transaction hash
- Only works with: Settlement scheme (exact scheme doesn’t support this)
- Example: Crossmint smart wallets (see Solana Example 4 below)
Why sendTransaction? Some wallet SDKs (like Crossmint, custodial wallets) don’t give you direct RPC access or expose signed transaction objects. They handle the entire transaction lifecycle through their API and only return a transaction hash. Use sendTransaction for these wallets.Important: Use raw cluster names (“mainnet-beta”, “devnet”, “testnet”) for the 
network field. The payment handler automatically converts these to x402 format (“solana-mainnet-beta”) internally.EVM Wallet Integration
Example 1: Browser Wallet (Phantom for EVM)
Here’s how to integrate a browser-based wallet like Phantom’s EVM support:Example 3: Custom EVM Wallet
If you’re building your own wallet or wrapping another provider:Solana Wallet Integration
Example 1: Browser Wallet (Phantom for Solana)
Here’s how to integrate Phantom wallet for Solana:Example 3: Advanced Solana Wallet with Custom Transaction Building
If your wallet needs to customize transaction building with a custom fee payer:Why both methods? This example uses 
buildTransaction to construct the transaction with a custom fee payer (not the wallet’s publicKey), then updateTransaction to add the wallet’s signature. The payment handler calls buildTransaction first, then updateTransaction if it exists, allowing you to separate transaction construction from signing.Use case: This pattern enables gas sponsorship where a service pays transaction fees for users, improving UX by eliminating the need for users to hold SOL for fees.Example 4: Smart Wallet with Settlement Scheme (Crossmint)
For Solana smart wallets (account abstraction), use the settlement scheme. The key difference is importing@faremeter/x-solana-settlement instead of @faremeter/payment-solana/exact:
When to use settlement vs exact scheme? Use the settlement scheme (
@faremeter/x-solana-settlement) for smart wallets like Crossmint and Squads that use account abstraction. Use the exact scheme (@faremeter/payment-solana/exact) for standard EOA wallets like Phantom. The settlement scheme uses escrow PDAs - the client creates an escrow payment, and the server settles it after verification.Complete Working Examples
Full EVM Example: Next.js App with Phantom
Full Solana Example: React App with Phantom
Reference Implementations
Faremeter includes several reference wallet implementations you can study:EVM Wallets
| Package | Description | GitHub | 
|---|---|---|
| @faremeter/wallet-evm | Local private key wallet for EVM chains | View Source | 
| @faremeter/wallet-ledger | Ledger hardware wallet with EVM support | View Source | 
Solana Wallets
| Package | Description | GitHub | 
|---|---|---|
| @faremeter/wallet-solana | Local keypair wallet for Solana | View Source | 
| @faremeter/wallet-crossmint | Crossmint smart wallet - uses x-solana-settlement scheme | View Source | 
| @faremeter/wallet-ledger | Ledger hardware wallet with Solana support | View Source | 
| @faremeter/wallet-solana-squads | Squads multisig wallet implementation | View Source | 
Implementation Notes: The Ledger wallet uses 
signEIP712HashedMessage (pre-hashing domain and message separately), while viem’s privateKeyToAccount uses standard EIP-712 signing. Both approaches produce compatible signatures when implemented correctly according to the EIP-712 specification.Payment Schemes
Faremeter supports multiple payment schemes to accommodate different wallet types and use cases. This guide focuses on the “exact” scheme, which is the most widely compatible:Exact Scheme (This Guide)
- EVM: Uses EIP-3009 (gasless USDC transfers with meta-transactions)
- Solana: Uses direct SPL token transfers
- Compatible with: EOA wallets (Phantom, MetaMask), hardware wallets (Ledger)
- Packages: @faremeter/payment-evm/exact,@faremeter/payment-solana/exact
Settlement Scheme (Advanced)
For smart wallets and use cases requiring on-chain settlement:- Solana: Uses @faremeter/x-solana-settlement with escrow PDAs
- Two-step flow: client creates escrow, server settles and closes it
- Race-condition safe via unique settle nonce
- Rent (~0.002 SOL) returned to payer on settlement
 
- Compatible with: Crossmint smart wallets, Squads multisig
- EVM: Under development - contact the team for smart wallet support
Why different schemes? EIP-3009 requires signing with an EOA private key for on-chain verification. Smart wallets use contract accounts without traditional private keys, so they need alternative payment schemes like settlement.
Troubleshooting
EVM: Signature Issues
EIP-712 Implementation- Ensure your signTypedDatafollows the EIP-712 specification exactly
- Test with a known-working reference like viem’s privateKeyToAccount
- Different wallet SDKs may have different EIP-712 implementations - verify yours produces valid signatures
- Signature doesn’t recover to the wallet address
- SDK doesn’t support EIP-712 typed data signing
- Wallet is a smart contract (use settlement scheme instead)
Solana: Transaction Failures
1. Missing Token Account- Check both SOL balance (for fees) and USDC balance (for payment)
- Need ~0.01 SOL for transaction fees
Next Steps
API Quickstart
Use your wallet to make payments with Corbits APIs
Faremeter Overview
Review the Faremeter architecture documentation
Community Support
Join the Corbits community for help
x402 Protocol
Learn about the underlying payment protocol
Additional Resources
- EIP-712 Specification - Learn about typed data signing
- EIP-3009 Specification - Gasless USDC transfers
- Solana Transaction Structure - Understanding Solana transactions
- x402 Protocol - The payment protocol Faremeter implements