How it works
There are two roles:- Client wallet: A OMS wallet held by each client. During onboarding, the client grants a one-time Explicit Smart Session that authorizes your platform to pull USDC up to a defined daily cap, locked to your treasury address only.
- Treasury wallet: An operator-controlled OMS wallet. It receives pulled USDC from client wallets and forwards it to the settlement destination (e.g., a card network settlement account or stablecoin bridge).
Prerequisites
- A project access key from the Polygon project dashboard
- Polygon mainnet configured (chain ID: 137)
- USDC on Polygon:
0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 - An operator-controlled treasury wallet
Install
Step 1: Client grants a Smart Session
Each client connects their OMS wallet during onboarding and grants one Explicit Smart Session. This session authorizes your backend to pull USDC up to a daily cap, locked to your treasury address. It cannot be used to send funds anywhere else. Configure this in your frontend provider:cumulative: true enforces the cap across all transfers during the session period, not per-transfer. A client with a 100,000 USDC cap cannot be exceeded in total until the session expires and they re-authorize.Step 2: Check client USDC balance
Before each pull, verify the client has sufficient USDC using the OMS Indexer API. This avoids failed transactions and lets you pull only what’s available.Step 3: Pull USDC from client wallets
Your backend runs a scheduled job that callstransfer on each client’s USDC balance via their active Smart Session. The session rules (address lock and cumulative cap) are enforced onchain by the client’s smart account.
Step 4: Push from treasury to settlement
Once USDC has accumulated in the treasury, forward it to the settlement destination using your operator-controlled treasury wallet. If your treasury is itself an OMS wallet, you can use the same SDK to manage outbound settlement.Step 5: Monitor with Indexer
After each run, check the live treasury balance and query transaction history to verify pulls settled correctly.Putting it together
A complete daily settlement run: check balances, pull from each client, push to settlement, and log the result:Security considerations
- Session locking: The
toaddress rule locks transfers to your treasury address only. A client’s session cannot be used to send funds anywhere else, even if your backend is compromised. - Cumulative cap:
cumulative: trueprevents the backend from pulling more than the authorized total across the session period. - Onchain enforcement: Session rules are enforced at the smart contract level. They cannot be bypassed by your backend or any third party.
- Key custody: Client wallets are non-custodial. Private keys are secured in AWS Nitro Enclaves via threshold cryptography. Neither your platform nor the operator holds user keys.
Next steps
Smart Sessions
How to scope, authorize, and revoke remote backend access to user wallets.
Wallet Quickstart
Set up an OMS wallet from scratch.
Allow Your Users to Earn
Route client USDC into DeFi yield vaults using Trails.
Wallet Operations
Full reference for sending transactions and reading balances.