Financial Primitives
Fee Agreements & Dynamic Rules
How Trivio models merchant discount rates (MDR), scheme assessments, and hierarchical rule evaluation.
MerchantFeeRule Data Contract
Every merchant discount agreement is modeled as an immutable rule with explicit priority matching:
fee-rule.tstypescript
import { MerchantFeeRule } from "@trivio.ink/core";
// High-priority international card rule with flat fee
const internationalRule: MerchantFeeRule = {
id: "RULE_VISA_INTL_TIER_1",
version: "1.2.0",
priority: 100, // Higher priority matches first
acquirerId: "ACQ_BOC",
currency: "LKR",
cardScheme: "visa",
cardRegion: "international",
cardFundingType: "credit",
effectiveFrom: "2026-01-01",
rateSource: "merchant_configured",
feeStructure: {
rateBasisPoints: 350, // 3.50% MDR
fixedFeeMinor: 2500, // 25.00 LKR fixed fee
},
};Priority Resolution & Specificity
When multiple fee rules match an incoming transaction, the rule with the highest numerical priority is applied.
- Terminal-specific rules override merchant-wide rules.
- International card rules override domestic blended rules.
- Credit card rules override debit card rules.
