Looking to charge fees for offramps? Visit Developer Fees for more details.
How Settlement Rules Work
1
Create settlement rule
Define fee calculation methods and destination wallets. Settlement rules support fixed and tiered pricing models with percentage or flat fee amounts.
2
Apply to virtual account
Associate the rule with a user’s virtual account. Rules must be created on the same blockchain network as the virtual account’s destination chain.
3
Automatic distribution
Fees are automatically calculated and distributed on each transaction. The transaction amount is received, fees are deducted, and payments are sent to specified wallet addresses.
Rule Configuration
Settlement rules support two calculation models that can be combined:- Fixed: Apply a single rate or value to all transactions
- Tiered: Apply different rates or values based on transaction amount ranges
Creating Settlement Rules
Create a settlement rule using the Create Settlement Rule endpoint.Request
Unique identifier for the request (recommend using UUID v4).
Blockchain network for the settlement rule (e.g.,
BASE, POLYGON, ETHEREUM, SOLANA).Whether to include HIFI platform fee in the calculation. Defaults to
false.Array of fee rule objects to apply (minimum 1 rule required). Each rule object contains:
Multiple rules can be applied to a single settlement rule configuration. The rules are processed in the order they are defined.
Response
Unique settlement rule ID. Use this when applying the rule to virtual accounts.
Blockchain network the rule is configured for. Must match the virtual account’s destination chain.
Whether HIFI platform fees are included in fee calculations.
Array of fee rules with their configuration, including type, calculation model, values, and beneficiary wallets.
For detailed field documentation, see the Create Settlement Rule API reference.
Rule Types
Settlement rules support two calculation models that can be combined to create flexible fee structures:Fixed Calculation with Fixed Value
Fixed Calculation with Fixed Value
Charge a flat fee amount per transaction regardless of transaction size.
Fixed Calculation with Percentage
Fixed Calculation with Percentage
Charge a percentage of the transaction amount using a single rate.
Tiered Calculation with Percentage
Tiered Calculation with Percentage
Charge a percentage using different rates based on transaction amount ranges. Useful for volume-based pricing.
For tiered rules, leave
min empty for the first tier and max empty for the last tier to create open-ended ranges.Applying Rules to Virtual Accounts
After creating a settlement rule, associate it with a specific user’s virtual account using the Apply Settlement Rule endpoint.Request
- userId (required): User ID who owns the virtual account
- accountId (required): Virtual account ID to apply the rule to
- ruleId (required): Settlement rule ID from the create response
Settlement rules must be created on the same blockchain network as the virtual account’s destination chain. For example, a virtual account configured for POLYGON can only use settlement rules created on POLYGON.
How Fee Distribution Works
When a transaction is processed through a virtual account with settlement rules:1
Transaction received
The transaction amount is received through the virtual account.
2
Fees calculated
Fees are automatically calculated based on the settlement rule configuration.
3
Amounts distributed
The remaining amount is sent to the virtual account’s destination wallet, and fee payments are sent to the specified wallet addresses.
Monitoring Fees
Track settlement transactions and fee distributions by monitoring the specified wallet addresses. Each fee distribution includes an on-chain transaction hash for verification.Key Concepts
Calculation Models
Calculation Models
Settlement rules support two calculation models:Fixed Model:
- Applies a single rate or value to all transactions
- Use for consistent pricing regardless of transaction size
- Example: 0.1% of all transactions or $1 flat fee per transaction
- Applies different rates or values based on transaction amount ranges
- Use for volume-based pricing (e.g., lower fees for larger transactions)
- Example: 0.1% for transactions under 1,000
Fee Types
Fee Types
Each rule can use one of two fee types:Percentage Fees:
- Calculated as a percentage of the transaction amount
- Specified as a decimal value (e.g.,
0.001for 0.1%) - Example: 0.1% of a 1
- Flat amount regardless of transaction size
- Specified as a number (e.g.,
0.5for $0.50) - Example: $1 flat fee per transaction
HIFI Fee Inclusion
HIFI Fee Inclusion
The
includeHIFIFee parameter controls whether HIFI’s platform fee is included in your fee calculation:- false (default): Your fee is calculated on the base transaction amount
- true: Your fee is calculated on the transaction amount plus HIFI’s fee
includeHIFIFee: true:- Transaction: $1,000
- HIFI fee: $10 (1%)
- Your fee (0.1%): Calculated on 1.01
Tiered Pricing
Tiered Pricing
Tiered rules use amount ranges to apply different rates:
- Leave
minempty for the first tier (0 to max) - Leave
maxempty for the last tier (min and above) - Tiers should not overlap and should cover all possible amounts
Rule Order
Rule Order
When multiple rules are specified, they are processed in order:
- Each rule is calculated independently
- Fees are deducted sequentially
- The final amount sent to the destination wallet is the transaction amount minus all fees
- Transaction: $1,000
- Rule 1 (0.1%): $1
- Rule 2 (1
- Total fees: $2
- Destination receives: $998
Chain Compatibility
Chain Compatibility
Settlement rules must match the virtual account’s blockchain:
- Create the rule on the same chain as the virtual account’s destination
- POLYGON virtual accounts require POLYGON settlement rules
- BASE virtual accounts require BASE settlement rules
- Attempting to apply an incompatible rule will fail
Getting Help
- 📧 Email: support@hifibridge.com
- 💬 Slack: Message us in our shared Slack channel
Related Resources
- Virtual Accounts - Set up reusable bank accounts for deposits
- Developer Fees - Fee calculation for offramp transactions
- API Reference - Complete endpoint documentation