Skip to content

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

$SetCurrencyToPricingMatrix(currency)

Parameters

  • currency (string) - ISO currency code (e.g., "GBP", "USD", "EUR")

Returns

  • PricingMatrix object

Example

$SetCurrencyToPricingMatrix("GBP");

$SetCommissionRateToPricingMatrix

Sets the commission rate applied to gross premium.

Signature

$SetCommissionRateToPricingMatrix(rate)

Parameters

  • rate (number) - Commission rate as decimal (e.g., 0.15 for 15%)

Returns

  • PricingMatrix object

Example

$SetCommissionRateToPricingMatrix(0.15);  // 15% commission

$SetIptRateToPricingMatrix

Sets the Insurance Premium Tax (IPT) rate.

Signature

$SetIptRateToPricingMatrix(rate)

Parameters

  • rate (number) - IPT rate as decimal (e.g., 0.12 for 12%)

Returns

  • PricingMatrix object

Example

$SetIptRateToPricingMatrix(0.12);  // 12% IPT

$SetFeeToPricingMatrix

Sets a fixed fee amount.

Signature

$SetFeeToPricingMatrix(amount)

Parameters

  • amount (number) - Fee amount

Returns

  • PricingMatrix object

Example

$SetFeeToPricingMatrix(25.00);  // £25 admin fee

$SetTaxDutyToPricingMatrix

Sets a fixed tax duty amount on the pricing matrix.

Signature

$SetTaxDutyToPricingMatrix(amount)

Parameters

  • amount (number) - Tax duty amount

Returns

  • PricingMatrix object

Example

$SetTaxDutyToPricingMatrix(5.00);

$SetPreCalculatedIptToPricingMatrix

Sets a pre-calculated IPT amount instead of calculating from rate.

Signature

$SetPreCalculatedIptToPricingMatrix(amount)

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

$SetPreCalculatedIptToPricingMatrix(60.00);  // Fixed £60 IPT

$SetPreCalculatedIptToAdjustmentDifferencePricingMatrix

Sets pre-calculated IPT for adjustment differences in MTAs.

Signature

$SetPreCalculatedIptToAdjustmentDifferencePricingMatrix(amount)

Parameters

  • amount (number) - Pre-calculated IPT adjustment amount

Returns

  • PricingMatrix object

Example

$SetPreCalculatedIptToAdjustmentDifferencePricingMatrix(5.50);

$SetMinimumPremiumToPricingMatrix

Sets a minimum net premium.

Signature

$SetMinimumPremiumToPricingMatrix(amount)

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 Total ledger entry.
  • PricingMatrix.minimumPremiumApplied is set to true, and the surcharge breakdown is stored in PricingMatrix.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

$ApplyIptToFeeInPricingMatrix(applyIptToFee)

Parameters

  • applyIptToFee (boolean) - If true, IPT is charged on the fee at the matrix IPT rate

Returns

  • PricingMatrix object

Example

$SetFeeToPricingMatrix(25.00);
$ApplyIptToFeeInPricingMatrix(true);  // IPT now applies to fee

Item Functions

$AddItemToPricingMatrix

Adds a premium item (base premium or component).

Signature

$AddItemToPricingMatrix(name, value, netRate)

Parameters

  • name (string) - Item description
  • value (number) - Item value (e.g. the sum insured, or the premium when netRate is 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

$AddPreCalculatedItemToPricingMatrix(name, net, gross, isMTARefundable, isMTAFullPremium)

Parameters

  • name (string) - Item description
  • net (number) - Net premium (before commission)
  • gross (number) - Gross premium (after commission)
  • isMTARefundable (boolean) - If true, refundable on MTA cancellation
  • isMTAFullPremium (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

$RemoveItemFromPricingMatrix(name)

Parameters

  • name (string) - Item name to remove

Returns

  • PricingMatrix object

Example

$RemoveItemFromPricingMatrix("Camera Cover");

$SetItemAsFullPremiumMTA

Sets whether an existing item is charged at full premium on an MTA instead of pro-rata.

Signature

$SetItemAsFullPremiumMTA(itemName, isFullPremium)

Parameters

  • itemName (string) - Name of an item already in the pricing matrix (exact match). If no item has that name, nothing changes
  • isFullPremium (boolean) - If true, $CalculateMTAPremium uses 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

$AddFactorToPricingMatrix(name, rate, accumulative, applicability)

Parameters

  • name (string) - Factor description
  • rate (number) - Factor rate (e.g., 1.25 = 125%)
  • accumulative (boolean) - If true, multiplies existing premium; if false, applies to base only
  • applicability (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

$AddItemFactorToPricingMatrix(itemName, factorName, rate, accumulative)

Parameters

  • itemName (string) - Target item name
  • factorName (string) - Factor description
  • rate (number) - Factor rate
  • accumulative (boolean) - Accumulative flag

Returns

  • PricingMatrix object

Example

$AddItemFactorToPricingMatrix("Camera Cover", "High Value Factor", 1.50, true);

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 $SetVoucherData to 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 name
  • rate (number) - Discount rate as a fraction
  • applicability (number, optional) - See the table above

Returns

  • PricingMatrix object

Example

$AddNetDiscountToPricingMatrix("Multi-Policy", 0.05);  // 5% off net

$AddInternalDiscountToPricingMatrix

Adds an internal discount (not visible to customer).

Signature

$AddInternalDiscountToPricingMatrix(name, rate)
$AddInternalDiscountToPricingMatrix(name, rate, applicability)

Parameters

  • name (string) - Discount name
  • rate (number) - Discount rate as a fraction
  • applicability (number, optional) - See the table above

Returns

  • PricingMatrix object

Example

$AddInternalDiscountToPricingMatrix("Partner Arrangement", 0.03);

$AddItemGrossDiscountToPricingMatrix

Adds a gross discount to a single item.

Signature

$AddItemGrossDiscountToPricingMatrix(itemName, discountName, rate)

Parameters

  • itemName (string) - Target item name (case-insensitive; the item must exist)
  • discountName (string) - Discount name
  • rate (number) - Discount rate as a fraction

Returns

  • PricingMatrix object

Example

$AddItemGrossDiscountToPricingMatrix("Camera Cover", "Bundle Discount", 0.15);

$AddItemNetDiscountToPricingMatrix

Adds a net discount to a single item.

Signature

$AddItemNetDiscountToPricingMatrix(itemName, discountName, rate)

Parameters

  • itemName (string) - Target item name (case-insensitive; the item must exist)
  • discountName (string) - Discount name
  • rate (number) - Discount rate as a fraction

Returns

  • PricingMatrix object

Example

$AddItemNetDiscountToPricingMatrix("Base Premium", "Item Discount", 0.10);

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 description
  • netRate (number) - Net premium
  • commissionRate (number) - Commission rate (decimal)
  • iptRate (number) - IPT rate (decimal)
  • isRefundable (boolean) - If true, refundable on cancellation
  • discountAllowed (boolean) - If true, discounts can apply to this add-on
  • isFullPremiumMTA (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 description
  • premium (number) - Premium including IPT
  • commissionRate (number) - Commission rate (decimal)
  • iptRate (number) - IPT rate (decimal)
  • isRefundable (boolean) - If true, refundable on cancellation
  • discountAllowed (boolean) - If true, discounts can apply to this add-on
  • isFullPremiumMTA (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

$AddPremiumAddOnToPricingMatrix("Breakdown Cover", 45.00, 0.20, 0.12, true, false, false);

$RemoveAddOnFromPricingMatrix

Removes an add-on by name.

Signature

$RemoveAddOnFromPricingMatrix(name)

Parameters

  • name (string) - Add-on name to remove

Returns

  • PricingMatrix object

Example

$RemoveAddOnFromPricingMatrix("Legal Expenses");

Lead Value Functions

$CalculateLeadValue

Calculates the lead value configured by $AddLeadValueFactorAndCostToPricingMatrix. Call it after the premium has been calculated.

Signature

$CalculateLeadValue()

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

$AddLeadValueFactorAndCostToPricingMatrix(aggregatorName, factor, distributionCost)

Parameters

  • aggregatorName (string) - Aggregator name
  • factor (number) - Multiplier applied to gross profit
  • distributionCost (number) - Cost deducted from the lead value

Returns

  • PricingMatrix object

Example

$AddLeadValueFactorAndCostToPricingMatrix("I-Wonder", 2.9, 34.39);

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