# Pricing Logic

Pricing Logic is the core of an insurance product. We understand that most companies use Excel to lay out the pricing structure of an insurance product, hence, at KASKO, we developed our pricing engine around Excel.

The configuration on Product Builder has essentially 2 parts, the **Pricing Logic** file and the **Validation Rules**.

#### :star:**Pricing Logic File**

You can keep your formula and sheets in your excel and simply add one KASKO formatted sheet Calculator to the first sheet of your excel. You can get the example Excel file here.

{% file src="<https://3958097797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHNwbN62wHJkXHE6QwYrR%2Fuploads%2FJ5MxF6z2Xg6WvbXQvTPd%2FKASKO%20Pricing%20Example.xlsx?alt=media&token=f4028ad8-cf65-470e-b273-320ff132a28b>" %}

In the KASKO Calculator sheet, you will see the below sections.

<table><thead><tr><th width="182">Section</th><th width="139.33333333333331">Column</th><th>Description</th></tr></thead><tbody><tr><td>Input Fields</td><td>Below B7 - E7</td><td><p>This is the section that will collect customer inputs and use these inputs in the premium calculation process. In these columns, you will define quote-relevant inputs and the underwriting rules.</p><ul><li><strong>Quote Relevant Inputs</strong><br>You should list out all the quote relevant input fields in <code>column B</code>. It only accepts letters, numbers and underscore <code>_</code> , for example <code>input_field_1</code> is correct and <code>£ Prämie</code> is incorrect.</li><li><strong>Field Value</strong><br>This column will be left empty and the user inputs will be injected accordingly.<br>While working on the excel, you may put in test values in this column and see if the calculation works as expected.</li><li><strong>Required</strong><br>In <code>column D</code> , you will input <code>TRUE</code> or <code>FALSE</code> to indicate whether the specific input is always required for calculating a quote. <code>TRUE</code> for always required; <code>FALSE</code> for not required. You can also put in formula to make the <code>TRUE or FALSE</code> dependant on the other input. For example, IF certain input is X, then <code>TRUE</code> otherwise <code>FALSE</code></li><li><strong>IsValid</strong><br>This allows you to define the more comprehensive underwriting rules for each input field. You will construct formula to check <code>column C</code> input and return <code>TRUE</code> for passing underwriting rules; <code>FALSE</code> for not passing.</li></ul><p>Example:</p><p>Row 8 - B7 - <code>module</code><br>Row 8 - C7 - (left empty)<br>Row 8 - D7 - <code>TRUE</code><br>Row 8 - E7 - <code>=IF(ISNA(MATCH(C7,'Allowed values'!C3:C4,0)),FALSE,TRUE)</code> > where by in <code>Allowed values</code> sheet C3, C4 are the only input value accepted, for example <code>module 1</code> &#x26; <code>module 2</code></p></td></tr><tr><td>Predefined Fields</td><td>Below G7 - H7</td><td><p>These are the fixed fields required for all pricing excel. You only need to fill in the values accordingly in <code>column H</code> .</p><p><code>G8</code> - <code>tax</code> ; <code>H8</code> - the tax % of your product<br><code>G9</code> - <code>billing_frequency</code> ;<br><code>G10</code> - <code>billing_frequency_unit</code> ;</p><p>The values for <code>billing_frequency</code> &#x26; <code>billing_frequency_unit</code> work together to define the payment frequency of this product. At KASKO, we currently support these frequencies:</p><ol><li>Single Payment (not recurring) - <code>billing_frequency = 1</code> &#x26; <code>billing_frequency_unit = N</code></li><li>Monthly Payment (recurring) - <code>billing_frequency = 1</code> &#x26; <code>billing_frequency_unit = M</code></li><li>Quarterly Payment (recurring) - <code>billing_frequency = 3</code> &#x26; <code>billing_frequency_unit = M</code></li><li>Half-Yearly Payment (recurring) - <code>billing_frequency = 6</code> &#x26; <code>billing_frequency_unit = M</code></li><li>Yearly Payment (recurring) - <code>billing_frequency = 1</code> &#x26; <code>billing_frequency_unit = Y</code></li></ol></td></tr><tr><td>Output Fields</td><td>Below J7 - K7</td><td><p>In this section, you will list out all the calculated values you want to either show throughout the customer or store in the policy data.</p><p>There are required output fields that need to be in place for all excel pricing (<code>J8:K23</code> from the KASKO example excel) and you can add additional output fields below <code>row 23</code></p><p>In the <code>Calculator</code> sheet, you should avoid heavy formula as it will have impact on the performance of quote generating. Instead, you should have the calculation/formula in separate sheets and you can reference the output value from that sheet in <code>Calculator</code> sheet.</p><p>There some output field naming rules that you should know. First of all, it only accepts letters, numbers, and underscore <code>_</code>; secondly, add one of the 2 prefixes to all the output names. <code>data.</code> prefix is for outputs that you want to store in the policy data; <code>extra_data.</code> prefix is for outputs that you only want to use on the FE during the customer journey. The <code>.</code> is used to cluster data into different levels. For example, these data <code>data.module</code> , <code>data.person_1.price</code> , <code>data.person_1.tax</code> , <code>data.person_2.price</code> , <code>data.person_2.tax</code> , <code>data.duration</code> will be stored like this:</p><p><code>1 data:{ 2 module: xxx, 3 duration: xxx, 4 person_1:{ 5 price: xxx, 6 tax: xxx 7 }, 8 person_2:{ 9 price: xxx, 10 tax: xxx 11 } 12 }</code></p></td></tr></tbody></table>

In a functioning excel, you should be able to see the calculated premiums and output fields in `column K` once you put in the test values in `column C`. You should be able to test various scenarios and cases to see if the premiums are returned correctly.

:exclamation::exclamation:**Important Notes for Pricing Excel**:exclamation::exclamation:

There is a list of output fields that should always be in the pricing excel. These are the default outputs that are already listed in the pricing template file. The fields are:

* billing\_cycles
* gross\_payment\_amount
* gross\_premium
* premium\_tax
* net\_premium
* net\_net\_premium
* net\_commission\_total
* tax\_rate
* duration\_strategy

Apart from the above fields, there are some additional fields.

:calendar: **Duration Strategy**

In the output field, there is a required field called **Duration Strategy**. This field defines how the policy start and end date should be defined. There are 4 duration strategies that can be used.

<details>

<summary>fixed_start</summary>

Fix start duration strategy is typically used for policies that have a specific start date (usually selected by the customers) but have an undefined end date (open ending). This means the policy with this duration strategy does not expire (lapse) unless it is cancelled.

:bulb:**Must be configured together**

With fixed\_start duration strategy, you must also include `policy_start_date` in the output field.

</details>

<details>

<summary>fixed_end</summary>

Fix end duration strategy is typically used for policies that have a fixed end date (usually set by the customer) but does not request the customers to select a start date. This means the policy with this duration strategy will expire (lapse) on a defined date unless it is cancelled prior to the date.

:bulb:**Must be configured together**

With fixed\_end duration strategy, you must also include `policy_end_date` in the output field.

</details>

<details>

<summary>fixed_start_with_interval</summary>

Fix start with interval strategy is typically used for policies that have a specific start date (usually selected by the customers) and the policies last for a defined period of time (X days/months/years) counting from the start date. This means the policy with this duration strategy will expire on a dynamic end date depending on defined the start date and end date unless it is cancelled prior to the end date.

:bulb:**Must be configured together**

With fixed\_start\_with\_interval duration strategy, you must also include `policy_start_date` and `policy_validity_interval` in the output fields.

For `policy_validity_interval` it should always be in the format P\_D/P\_M/P\_Y depending on the duration set. Below are some duration examples and the corresponding values.

* 7 days - P7D
* 14 days - P14D
* 6 months - P6M
* 12 months or 1 year - P12M or P1Y
* 3 years - P3Y

</details>

<details>

<summary>fixed_start_and_end_date</summary>

Fix start and end end date duration strategy is typically used for policies that have a specific start date (usuaully set by the customers) and the policies will end on a specific end date (usually set by the customer). This means the policy with this duration strategy will start on the defined date and end on the defined date unless it is cancelled prior to the end date.

:bulb:**Must be configured together**

With fixed\_start\_with\_interval duration strategy, you must also include `policy_start_date` and `policy_end_date` in the output fields.

</details>

#### :star:**Validation Rules** <a href="#yellow_star-validation-rules" id="yellow_star-validation-rules"></a>

Apart from the Pricing Excel file, you will also need the Validation Rules for all the quote data of your product. Validation Rules are written in JSON, below is an example:

<details>

<summary>Pricing Logic Validation Rules Example</summary>

```
{
	"quote": [
		{
			"name": "field_1_number",
			"path": "data",
			"validation": "integer|required"
		},
		{
			"name": "field_2_module",
			"path": "data",
			"validation": "required|string|in:module_1,module_2"
		},
		{
			"name": "field_3_date",
			"path": "data",
			"validation": "iso_date|required|string|after:1 month from yesterday"
		}
	],
	"quote_patch": [],
	"pricing_variables": []
}
```

</details>

In the example, you can see that each of the input fields in your pricing would include 3 parts in the Validation Rules.

<table><thead><tr><th width="194">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>This should correspond to the input field names in the Pricing Logic Excel.</td></tr><tr><td><strong>Path</strong></td><td>This is usually <code>data</code> unless you have other data structures for your Pricing Logic input fields.</td></tr><tr><td><strong>Validation</strong></td><td><p>This usually includes a few things:</p><ol><li>data format - for example, <code>string</code> , <code>integer</code> , <code>iso_date</code></li><li>required/not required - if the data is always required, you should put <code>required</code> , otherwise, left empty</li><li>other validation rules - this can be (1) limiting the input to a list of allowed value; (2) checking the input value to be within certain range; any other validations</li></ol></td></tr></tbody></table>

Once you have a functioning Pricing Logic Excel file and the Validation Rules, you can go to Product Builder → Pricing Logic and start configuring for your product.

{% hint style="warning" %}
You will need to remove all the values (column C) for all the input fields so that the pricing is clean and without any prefilled values.
{% endhint %}

<figure><img src="https://3958097797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHNwbN62wHJkXHE6QwYrR%2Fuploads%2FnNqC5ohXMGjaih42H8L7%2FScreenshot%202025-12-02%20at%2014.51.00.png?alt=media&#x26;token=6e6a6f52-d160-4b1b-9811-f1874058141d" alt=""><figcaption><p>Pricing Logic Edit Screen Example</p></figcaption></figure>

<table><thead><tr><th width="217">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Description</strong></td><td>This is an optional field for you to describe this Pricing Logic Excel version.</td></tr><tr><td><strong>Type</strong></td><td>This is preselected as Excel type</td></tr><tr><td><strong>File</strong></td><td>This is the Pricing Logic Excel file</td></tr><tr><td><strong>Payment Frequency</strong></td><td><p>This defines the payment frequencies your product supports. This can be a multi-select if your product should support multiple frequencies. These is the supported frequency list</p><ul><li>Single</li><li>Recurring - Yearly</li><li>Recurring - Half-Yearly</li><li>Recurring - Four-Weekly</li><li>Recurring - Quarterly</li><li>Recurring - Monthly</li></ul></td></tr></tbody></table>

<figure><img src="https://3958097797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHNwbN62wHJkXHE6QwYrR%2Fuploads%2FnFuq80DCnkPEEXNNJDnh%2FScreenshot%202025-12-02%20at%2014.53.24.png?alt=media&#x26;token=df183dc3-3a7e-410b-ba00-7879c0d98487" alt=""><figcaption><p>Pricing Logic Validation Rule - Create Screen Example</p></figcaption></figure>

<figure><img src="https://3958097797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHNwbN62wHJkXHE6QwYrR%2Fuploads%2Fzh6BOIzlD9xTpqEN3dFo%2FScreenshot%202025-12-02%20at%2014.54.02.png?alt=media&#x26;token=8e7cb078-c93a-4ce8-a9cf-9fba3011724f" alt=""><figcaption><p>Pricing Logic - Manual Test Screen Example</p></figcaption></figure>

When you finish the Pricing Logic Configuration, you can go to the `Manual Test`. Here on the left hand side, you can see a dropdown of the payment frequencies and the input fields of the product; on the right hand side, you can see a blank output screen.

This area is for you to run manual test of your Pricing Logic, by inputting different values on the left hand side and click `Run Test` on the top right. Once clicked, you will see the return of the pricing calculation on the right hand side in the output area.

Once the Pricing Logic is configured and you want to update the pricing calculation for your product, simply go back to Pricing Logic Configuration screen. There you can download the latest Pricing Logic Excel and make the necessary update to your Pricing Logic Excel file. Once the changes are made, you can upload it to the Product Builder (and update the Validation Rules if there are any changes there as well).
