Looking to charge fees on Offramps instead? See Developer Fees.
How it works
1
Create a Settlement Rule
Define up to 10 fee rules and their destination wallets. Not tied to any one Virtual Account - it’s a standalone resource you can reuse across accounts on the same chain.
2
Apply it to a Virtual Account
Associate the rule with a specific user’s Virtual Account by ID. The rule’s
chain must match the account’s destination chain.3
Automatic distribution
Each deposit is split the moment it converts: the destination wallet receives the remainder, and each rule’s cut is sent on-chain to its configured wallet.
Rule Settings
Each entry inrules (1-10 per Settlement Rule) describes one cut of the deposit:
type
type
PERCENTAGE: Fee amount is based on a percentage of the ticket size.FIXED: Fee amount is fixed and does not change based on ticket size.
calculationModel
calculationModel
FIXED: a single rate/amount for every deposit.TIERED: rate/amount varies by deposit size.
value
value
Required when
calculationModel is FIXED, omitted when TIERED.PERCENTAGE: a decimal between 0.0001 and 0.5 (0.01%-50%).FIXED: a flat stablecoin amount between 0.01 and 10,000,000.
tiers
tiers
Required when
calculationModel is TIERED, omitted when FIXED. Array of { upTo, value } (up to 10), where value follows the same bounds as above based on the rule’s type. Exactly one tier must have upTo: null - that’s the open-ended top tier covering everything above the highest breakpoint.ExampleHow the Fee Math Works
1
Flat fees come off first
Every
FIXED-type rule deducts its amount directly from the deposit. For TIERED flat rules, the tier is picked using the deposit’s full size, not any already-reduced remainder.2
Percentage fees are solved against what's left, not the deposit
All
PERCENTAGE-type rules’ rates are summed into one combined rate, then the destination wallet’s share is solved so that destinationAmount + (destinationAmount × combined rate) equals the amount remaining after flat fees. Each percentage rule then takes its own rate of that destination share - so a 1% rule doesn’t take 1% of the deposit, it takes 1% of what the destination wallet ends up with. TIERED percentage rules pick their rate the same way as tiered flat fees, off the full deposit size.3
The destination wallet gets the remainder
Whatever’s left after every flat and percentage cut is sent to the Virtual Account’s destination wallet, on-chain, in the same batch as the fee payouts.
Example
A 1,000 USDC deposit with a flat fee of 5 USDC and a percentage fee of 2%:- The flat fee comes off first:
1,000 − 5 = 995remaining. - The percentage fee is solved against that remainder:
destinationAmount = 995 / 1.02 ≈ 975.49, so the percentage-fee wallet receives995 − 975.49 = 19.51(2% of the destination’s share, not of the original 995). - Final split:
5to the flat-fee wallet,19.51to the percentage-fee wallet,975.49to the Virtual Account’s destination wallet.
Create a Settlement Rule
RequestApply a Settlement Rule to a Virtual Account
settlementRuleId field reflects the active rule - see Virtual Accounts.
Remove a Settlement Rule from a Virtual Account
Future deposits stop being split; the Virtual Account’s full deposit amount goes to its destination wallet again.Getting Help
- 📧 Email: support@hifi.com
- 💬 Slack: Message us in our shared Slack channel
Related Resources
- Virtual Accounts - The deposit accounts Settlement Rules attach to
- Developer Fees - Fee calculation for Offramp transactions