Pricing Matrix Functions¶
The Pricing Matrix is the core data structure for insurance premium calculations. These 25 functions build and manipulate pricing structures, applying items, factors, discounts, taxes, and regulatory charges.
Configuration Functions¶
$SetCurrencyToPricingMatrix¶
Sets the currency for the pricing matrix.
Signature
Parameters
currency(string) - ISO currency code (e.g., "GBP", "USD", "EUR")
Returns
- PricingMatrix object
Example
$SetCommissionRateToPricingMatrix¶
Sets the commission rate applied to gross premium.
Signature
Parameters
rate(number) - Commission rate as decimal (e.g., 0.15 for 15%)
Returns
- PricingMatrix object
Example
$SetIptRateToPricingMatrix¶
Sets the Insurance Premium Tax (IPT) rate.
Signature
Parameters
rate(number) - IPT rate as decimal (e.g., 0.12 for 12%)
Returns
- PricingMatrix object
Example
$SetFeeToPricingMatrix¶
Sets a fixed fee amount.
Signature
Parameters
amount(number) - Fee amount
Returns
- PricingMatrix object
Example
$SetTaxDutyToPricingMatrix¶
Sets a fixed tax duty amount on the pricing matrix.
Signature
Parameters
amount(number) - Tax duty amount
Returns
- PricingMatrix object
Example
$SetPreCalculatedIptToPricingMatrix¶
Sets a pre-calculated IPT amount instead of calculating from rate.
Signature
Parameters
amount(number) - Pre-calculated IPT amount
Returns
- PricingMatrix object
Behaviour
- Marks the matrix as
iptPreCalculated. IPT is then not recalculated from the rate, and add-ons get an IPT rate and IPT of 0 so their IPT is not counted twice.
Example
$SetPreCalculatedIptToAdjustmentDifferencePricingMatrix¶
Sets pre-calculated IPT for adjustment differences in MTAs.
Signature
Parameters
amount(number) - Pre-calculated IPT adjustment amount
Returns
- PricingMatrix object
Example
$SetMinimumPremiumToPricingMatrix¶
Sets a minimum net premium.
Signature
Parameters
amount(number) - Minimum net premium amount
Returns
- PricingMatrix object
Behaviour
When the quote is calculated with any quote type other than "Regular", the minimum is applied if the gross is below amount / (1 - commissionRate):
- The shortfall is added as a minimum premium surcharge, with its own net (
amount - currentNet), commission (grossed up at the matrix commission rate), IPT (at the matrix IPT rate) and premium. - The surcharge values are added to the policy
Totalledger entry. PricingMatrix.minimumPremiumAppliedis set to true, and the surcharge breakdown is stored inPricingMatrix.minimumPremiumSurcharge({ net, commission, ipt, gross, premium }).
The minimum premium is not applied to "Regular" calculations, which is the quote type MTAs use.
Example
$SetMinimumPremiumToPricingMatrix(100.00); // Minimum £100 net premium
$CalculatePremiumAdditive("NewBusiness");
if (PricingMatrix.minimumPremiumApplied) {
surchargePremium = PricingMatrix.minimumPremiumSurcharge.premium;
}
$ApplyIptToFeeInPricingMatrix¶
Sets whether IPT is applied to the fee.
Signature
Parameters
applyIptToFee(boolean) - If true, IPT is charged on the fee at the matrix IPT rate
Returns
- PricingMatrix object
Example
Item Functions¶
$AddItemToPricingMatrix¶
Adds a premium item (base premium or component).
Signature
Parameters
name(string) - Item descriptionvalue(number) - Item value (e.g. the sum insured, or the premium whennetRateis 1)netRate(number) - Rate applied to the value. Net premium =value * netRate
Returns
- PricingMatrix object
Example
$AddItemToPricingMatrix("Base Premium", 500.00, 1.0); // Net £500
$AddItemToPricingMatrix("Camera Cover", 2000.00, 0.035); // 3.5% of £2,000 = £70 net
$AddPreCalculatedItemToPricingMatrix¶
Adds an item with pre-calculated net and gross premiums.
Signature
Parameters
name(string) - Item descriptionnet(number) - Net premium (before commission)gross(number) - Gross premium (after commission)isMTARefundable(boolean) - If true, refundable on MTA cancellationisMTAFullPremium(boolean) - If true, charges full premium on MTA (not pro-rated)
Returns
- PricingMatrix object
Example
// Pre-calculated item from third-party system
$AddPreCalculatedItemToPricingMatrix("Third Party Item", 170.00, 200.00, true, false);
// Non-refundable setup fee with full premium on MTA
$AddPreCalculatedItemToPricingMatrix("Setup Fee", 50.00, 59.00, false, true);
$RemoveItemFromPricingMatrix¶
Removes an item by name.
Signature
Parameters
name(string) - Item name to remove
Returns
- PricingMatrix object
Example
$SetItemAsFullPremiumMTA¶
Sets whether an existing item is charged at full premium on an MTA instead of pro-rata.
Signature
Parameters
itemName(string) - Name of an item already in the pricing matrix (exact match). If no item has that name, nothing changesisFullPremium(boolean) - If true,$CalculateMTAPremiumuses a pro-rata factor of 1 for this item when it is added, removed or changed
Returns
- PricingMatrix object
Example
$AddItemToPricingMatrix("Setup Charge", 30.00, 1.0);
$SetItemAsFullPremiumMTA("Setup Charge", true);
Factor Functions¶
Factors are multiplicative adjustments (e.g., age factors, risk factors).
$AddFactorToPricingMatrix¶
Adds a factor to the pricing matrix.
Signature
Parameters
name(string) - Factor descriptionrate(number) - Factor rate (e.g., 1.25 = 125%)accumulative(boolean) - If true, multiplies existing premium; if false, applies to base onlyapplicability(number, optional) -0= items and add-ons (default),1= items only,2= add-ons only
Returns
- PricingMatrix object
Example
$AddFactorToPricingMatrix("Age Factor", 1.25, true, 0); // 25% increase
$AddFactorToPricingMatrix("No Claims Discount", 0.90, true, 0); // 10% reduction
$AddItemFactorToPricingMatrix¶
Adds a factor specific to an item.
Signature
Parameters
itemName(string) - Target item namefactorName(string) - Factor descriptionrate(number) - Factor rateaccumulative(boolean) - Accumulative flag
Returns
- PricingMatrix object
Example
Discount Functions¶
Discount rates are fractions: 0.10 is a 10% discount and 1 is a 100% discount. There are no fixed-amount discounts.
The optional applicability argument sets what a discount applies to:
| Value | Applies to |
|---|---|
0 |
Items and add-ons (default) |
1 |
Items only |
2 |
Add-ons only |
3 |
Fee only |
4 |
Items and fee |
5 |
Add-ons and fee |
6 |
Items, add-ons and fee |
$AddGrossDiscountToPricingMatrix¶
Adds a discount applied to gross premium.
Signature
$AddGrossDiscountToPricingMatrix(name, rate)
$AddGrossDiscountToPricingMatrix(name, rate, applicability)
Parameters
name(string) - Discount name (used by$SetVoucherDatato find the voucher discount)rate(number) - Discount rate as a fraction (e.g. 0.10 for 10%)applicability(number, optional) - See the table above
Returns
- PricingMatrix object
Example
$AddGrossDiscountToPricingMatrix("Loyalty Discount", 0.10); // 10% off items and add-ons
$AddGrossDiscountToPricingMatrix("Fee Promo", 0.50, 3); // 50% off the fee only
$AddNetDiscountToPricingMatrix¶
Adds a discount applied to net premium (before commission).
Signature
$AddNetDiscountToPricingMatrix(name, rate)
$AddNetDiscountToPricingMatrix(name, rate, applicability)
Parameters
name(string) - Discount namerate(number) - Discount rate as a fractionapplicability(number, optional) - See the table above
Returns
- PricingMatrix object
Example
$AddInternalDiscountToPricingMatrix¶
Adds an internal discount (not visible to customer).
Signature
$AddInternalDiscountToPricingMatrix(name, rate)
$AddInternalDiscountToPricingMatrix(name, rate, applicability)
Parameters
name(string) - Discount namerate(number) - Discount rate as a fractionapplicability(number, optional) - See the table above
Returns
- PricingMatrix object
Example
$AddItemGrossDiscountToPricingMatrix¶
Adds a gross discount to a single item.
Signature
Parameters
itemName(string) - Target item name (case-insensitive; the item must exist)discountName(string) - Discount namerate(number) - Discount rate as a fraction
Returns
- PricingMatrix object
Example
$AddItemNetDiscountToPricingMatrix¶
Adds a net discount to a single item.
Signature
Parameters
itemName(string) - Target item name (case-insensitive; the item must exist)discountName(string) - Discount namerate(number) - Discount rate as a fraction
Returns
- PricingMatrix object
Example
Add-On Functions¶
Add-ons are optional coverages or charges with their own commission/IPT structure.
$AddAddOnToPricingMatrix¶
Adds an add-on with full pricing configuration.
Signature
$AddAddOnToPricingMatrix(name, netRate, commissionRate, iptRate, isRefundable, discountAllowed, isFullPremiumMTA)
Parameters
name(string) - Add-on descriptionnetRate(number) - Net premiumcommissionRate(number) - Commission rate (decimal)iptRate(number) - IPT rate (decimal)isRefundable(boolean) - If true, refundable on cancellationdiscountAllowed(boolean) - If true, discounts can apply to this add-onisFullPremiumMTA(boolean) - If true, charges full premium on MTA (not pro-rated)
Returns
- PricingMatrix object
Example
// Refundable add-on with discounts allowed, pro-rated on MTA
$AddAddOnToPricingMatrix("Legal Expenses", 25.00, 0.15, 0.12, true, true, false);
// Non-refundable add-on, full premium on MTA
$AddAddOnToPricingMatrix("Setup Fee", 50.00, 0.10, 0.12, false, false, true);
Rounding
- The premium (
net / (1 - commissionRate)plus IPT, after any discounts) is rounded to 2 decimals first. - IPT is then taken out of the rounded premium (
premium * iptRate / (1 + iptRate)), and gross is premium minus IPT. - Commission is gross minus net, rounded. This avoids penny drift between the add-on premium and its parts.
- When the matrix has pre-calculated IPT (
$SetPreCalculatedIptToPricingMatrix), the add-on's IPT rate and IPT are set to 0 and its IPT is removed from its premium when the quote is calculated.
$AddPremiumAddOnToPricingMatrix¶
Adds an add-on from its final (IPT-inclusive) premium, working backwards to gross, IPT, net and commission.
Signature
$AddPremiumAddOnToPricingMatrix(name, premium, commissionRate, iptRate, isRefundable, discountAllowed, isFullPremiumMTA)
Parameters
name(string) - Add-on descriptionpremium(number) - Premium including IPTcommissionRate(number) - Commission rate (decimal)iptRate(number) - IPT rate (decimal)isRefundable(boolean) - If true, refundable on cancellationdiscountAllowed(boolean) - If true, discounts can apply to this add-onisFullPremiumMTA(boolean) - If true, charges full premium on MTA (not pro-rated)
Gross = premium / (1 + iptRate), IPT = premium - gross, net = gross * (1 - commissionRate), each rounded to 2 decimals.
Returns
- PricingMatrix object
Example
$RemoveAddOnFromPricingMatrix¶
Removes an add-on by name.
Signature
Parameters
name(string) - Add-on name to remove
Returns
- PricingMatrix object
Example
Lead Value Functions¶
$CalculateLeadValue¶
Calculates the lead value configured by $AddLeadValueFactorAndCostToPricingMatrix. Call it after the premium has been calculated.
Signature
Parameters
- None
Calculation
- Gross profit =
(premium - fee) / (1 + iptRate) + fee - net - Lead value =
grossProfit * factor - distributionCost
Both are rounded to 2 decimals and stored in PricingMatrix.leadValue.
Returns
- PricingMatrix object
Example
$AddLeadValueFactorAndCostToPricingMatrix("I-Wonder", 2.9, 34.39);
$CalculatePremiumAdditive("NewBusiness");
$CalculateLeadValue();
$AddLeadValueFactorAndCostToPricingMatrix¶
Configures the lead value for an aggregator.
Signature
Parameters
aggregatorName(string) - Aggregator namefactor(number) - Multiplier applied to gross profitdistributionCost(number) - Cost deducted from the lead value
Returns
- PricingMatrix object
Example
Complete Example¶
// Initialize pricing matrix
$SetCurrencyToPricingMatrix("GBP");
$SetCommissionRateToPricingMatrix(0.15);
$SetIptRateToPricingMatrix(0.12);
$SetMinimumPremiumToPricingMatrix(100.00);
// Add base premium
$AddItemToPricingMatrix("Base Premium", 450.00, 1.0);
// Apply risk factors
$AddFactorToPricingMatrix("Age Factor", 1.20, true, 0); // 20% increase
$AddFactorToPricingMatrix("No Claims Discount", 0.85, true, 0); // 15% decrease
// Add discounts
$AddGrossDiscountToPricingMatrix("Multi-Policy", 0.10); // 10% off
// Add optional coverages
$AddAddOnToPricingMatrix("Legal Expenses", 25.00, 0.15, 0.12, true, true, false);
$AddAddOnToPricingMatrix("Breakdown Cover", 45.00, 0.10, 0.12, true, true, false);
// Set admin fee
$SetFeeToPricingMatrix(20.00);
// Calculate final premium
$CalculatePremiumAdditive("NewBusiness");
// PricingMatrix.Premium now contains final premium with all adjustments
Next Steps¶
- Quote Calculation Functions - Calculate premiums and handle policy changes
- Examples - Complete workflow examples