# Pricing

Roomle Configurator can display prices of the current configuration. There are two ways of adding the prices. Prices can be scripted using component.pricing attribute or Roomle Price Service can be used.

# Price Service

Price service provides you with a total price of your current configuration. It does so in the way that it takes the article numbers and their counts from the partlist and computes the total price based on those. A CSV table of article numbers vs prices needs to be provided. Price service works in a catalogue with the "Publicly orderable" attribute set to true and if there is a price.csv uploaded, which is done in PDC using the "Import Prices" field. This field is visible if you have correct PDC access rights.

The prices.csv file example:

"article_number","price","currency_symbol"
"312.532.124","79.99","€"
"312.532.128","89.99","€"

Notice that a price and currency symbol is defined with every articleNr. If an articleNr is missing, its price will be 0.

You can also override the prices and currency symbols for different countries by providing a column with a _countrycode suffix. The column without those suffixes is taken as a default, being overriden by the eventual country, for example:

"article_number","price","currency_symbol","price_uk","currency_symbol_uk"
"312.532.124","79.99","€","71.99","GBP"
"312.532.128","89.99","€","80.99","GBP"

If you have a proper set of articleNr, there are no extra efforts from the scripting side other than creating the price list csv.

To run a configurator with the price service, you must add two arguments to the address:
&usePriceService=true
and
&overrideTenant=\<tenantNumber\> or &configuratorId=\<configuratorSettingsId\>

You can ask your Roomle Contact Person to provide you with the tenant number or the configurator settings. Configurator settings user interface will be eventually added to PDC.

# Scripted Prices

This is a legacy feature that should not be used unless abolutely necessary with no other option. Prices in the scripts are hard to maintain and insecure - becasue component definitions can be downloaded and prices can therefore be isolated from them. See example (https://www.roomle.com/t/cp/?id=isdt:example_roomleprice&useRoomlePrice=true). Notice, useRoomlePrice=true is present in the address, telling the configurator to take the prices from the script.

Link to the example component definition

In the example, there is pricing with one object. You can have different prices for different regions. The RML_DEFAULT region is the fallback region. Price is then computed from parameters and current state of internal variables.

{
    "id": "isdt:example_roomleprice",
    ...
    "pricing": [
        {
            "region": "RML_DEFAULT",
            "currency": "EUR",
            "price": "
                if (material == 'candy:florida_light_blue') { pricePerSqM = 16; }
                if (material == 'candy:florida_rot') { pricePerSqM = 18; }
                if (material == 'candy:florida_saphran') { pricePerSqM = 20; }
                if (material == 'candy:florida_stone') { pricePerSqM = 22; }
                price = pricePerSqM * (width / 1000) * (length / 1000);
            "
        }
    ]
}

To achieve such a functionality using the price service, add another article number for the fabric with price per square metres. Then use the subcomponent partlist entry template, setting numberInPartList as the amount of square metres.