Quantity Pricing Integration
This article explains how to integrate the quantity pricing module.
Introduction
Section titled “Introduction”Quantity pricing integration is performed by sending a JSON string containing the price-by-quantity variations in field 27 of records in Table 13 - Product Prices.
Below is a practical scenario to facilitate understanding.
Example Scenario
Section titled “Example Scenario”Suppose the price of the product 20 KG BAG RICE FEED has the following tier prices:
| Tier Description | Minimum Quantity (>=) | List Price | Maximum Discount | Minimum Price | Maximum Markup | Maximum Price |
| Under 100 KG | 0 | $ 19.00 | 10% | $ 17.10 | 12% | $ 21.28 |
| Between 100 and 200 KG | 5 | $ 18.50 | 8% | $ 17.02 | 14% | $ 21.09 |
| Between 200 and 500 KG | 10 | $ 18.00 | 6% | $ 16.92 | 16% | $ 20.88 |
| Between 500 and 800 KG | 25 | $ 17.50 | 4% | $ 16.80 | 18% | $ 20.65 |
| 800 KG or more | 40 | $ 17.00 | 2% | $ 16.66 | 20% | $ 20.40 |
Full JSON Example
Section titled “Full JSON Example”The JSON string representing the example scenario is shown below:
NOTE: At the end of this article you will find the documentation for each JSON attribute.
[ { "descricao": "Under 100 KG", "qtdeInicial": 0, "valorUnitario": 19, "percDescontoMaximo": 10, "percAcrescimoMaximo": 12 }, { "descricao": "Between 100 and 200 KG", "qtdeInicial": 5, "valorUnitario": 18.5, "percDescontoMaximo": 8, "percAcrescimoMaximo": 14 }, { "descricao": "Between 200 and 500 KG", "qtdeInicial": 10, "valorUnitario": 18, "percDescontoMaximo": 6, "percAcrescimoMaximo": 16 }, { "descricao": "Between 500 and 800 KG", "qtdeInicial": 25, "valorUnitario": 17.5, "percDescontoMaximo": 4, "percAcrescimoMaximo": 18 }, { "descricao": "800 KG or more", "qtdeInicial": 40, "valorUnitario": 17, "percDescontoMaximo": 2, "percAcrescimoMaximo": 20 }]NOTE: For easier viewing, line breaks and formatting are shown; however, when sending data in Demander’s standard layout, line breaks should not be included.
Summary JSON Example
Section titled “Summary JSON Example”Below is the simplest version of the JSON, containing only the mandatory attributes.
Notice that the initial tier starting at zero is optional; if omitted, the app uses the product’s regular price.
[ { "qtdeInicial": 5, "valorUnitario": 18.50 }, { "qtdeInicial": 10, "valorUnitario": 18.00 }, { "qtdeInicial": 25, "valorUnitario": 17.50 }, { "qtdeInicial": 40, "valorUnitario": 17.00 }]JSON Documentation
Section titled “JSON Documentation”The JSON to be sent consists of an array of objects, where each object can have the following attributes:
| Name | Attribute | Required | Explanation |
| Tier name | descricao | No | Optional attribute. Used to provide a descriptive name for the tier. EX: Up to 100 KG, Above 800 KG |
| Initial quantity | qtdeInicial | Yes | Determines from which product quantity the price applies. NOTE: We use >= (greater than or equal to) to match the tier based on quantity. |
| Price | valorUnitario | Yes | Determines the unit value of the product. |
| % Max discount | percDescontoMaximo | No | Optional attribute. Determines the maximum discount percentage allowed in this tier. When omitted, the system uses the default percentage from Table 13 or company settings. |
| % Max markup | percAcrescimoMaximo | No | Optional attribute. Determines the maximum markup percentage allowed in this tier. When omitted, the system uses the default percentage from Table 13 or company settings. |
Table 13 Line Example
Section titled “Table 13 Line Example”Below is an example of a product price line/record including the quantity pricing JSON:
13|99999|48|UN||200.00|20|0|0|||||||||7.57|2.8||||||||[ { "descricao": "Under 100 KG", "qtdeInicial": 0, "valorUnitario": 19, "percDescontoMaximo": 10, "percAcrescimoMaximo": 12 }, { "descricao": "Between 100 and 200 KG", "qtdeInicial": 5, "valorUnitario": 18.5, "percDescontoMaximo": 8, "percAcrescimoMaximo": 14 }, { "descricao": "Between 200 and 500 KG", "qtdeInicial": 10, "valorUnitario": 18, "percDescontoMaximo": 6, "percAcrescimoMaximo": 16 }, { "descricao": "Between 500 and 800 KG", "qtdeInicial": 25, "valorUnitario": 17.5, "percDescontoMaximo": 4, "percAcrescimoMaximo": 18 }, { "descricao": "800 KG or more", "qtdeInicial": 40, "valorUnitario": 17, "percDescontoMaximo": 2, "percAcrescimoMaximo": 20 }]|[ { "qtdeInicial": "5", "valorUnitario": "100.00", "percDescontoMaximo": 10.00, "percAcrescimoMaximo": 10.00 }, { "qtdeInicial": "5", "valorUnitario": "92.50", "percDescontoMaximo": 5.00, "percAcrescimoMaximo": 5.00 }, { "qtdeInicial": "20", "valorUnitario": "80.00" }]