How it works
- Deposit: Your wallet deposits USDC into a payment channel on-chain (the SDK handles this automatically when needed).
- Voucher: Each paid request includes a signed cumulative voucher for the channel’s total claimable amount.
- Verify: The server checks the voucher signature instantly — no on-chain transaction per request.
- Claim: The server periodically claims vouchers from many channels in a single on-chain batch transaction.
Set up the signer
The signer needs apublicClient with readContract capability so the SDK can recover channel state from on-chain. Without this, you’ll get invalid_batch_settlement_evm_cumulative_below_claimed errors.
rpcUrl is critical — it gives the signer readContract access to query the channel’s on-chain state. Without it, the SDK cannot recover channel balances after a restart.