Skip to content
Light
English

Quantity Pricing Integration

This article explains how to integrate the quantity pricing module.

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.

Tiers can also be managed visually under Products > Prices > Edit, in Quantity pricing. The module walkthrough explains New, Edit, Delete, Save and Cancel, with screenshots.

The popup uses the same five integration attributes:

Screen field JSON attribute Required
Tier description descricao No
Minimum quantity qtdeInicial Yes
List price (R$) valorUnitario Yes
Maximum discount (%) percDescontoMaximo No
Maximum markup (%) percAcrescimoMaximo No

Save in the popup adds or replaces the tier in the form’s collection and updates ListaPrecoProduto.jsonPrecoPorQuantidade. Deletion removes only the selected tier. Changes are persisted when you click Update in the price form, and tiers are loaded again when you reopen that same record. Other price records, tiers and existing attributes are preserved.

Absent percentages remain absent: the popup does not convert them to zero. Leaving a field blank, including after erasing an entered value, preserves inheritance; entering zero sets a zero limit for the tier. Minimum and maximum prices are calculated from the effective percentages for display only, without adding attributes to the JSON.

The starting quantity is inclusive. A tier with zero qtdeInicial is optional; when no tier applies, the product’s normal price is retained. JSON remains editable and synchronized with the grid. Empty content is accepted, and invalid content is flagged without being silently erased.

Suppose the price of the product 20 KG BAG RICE FEED has the following tier prices:

Tier Description

Minimum Quantity

(>=)

List PriceMaximum DiscountMinimum PriceMaximum MarkupMaximum Price
Under 100 KG0$ 19.0010%$ 17.1012%$ 21.28
Between 100 and 200 KG5$ 18.508%$ 17.0214%$ 21.09
Between 200 and 500 KG10$ 18.006%$ 16.9216%$ 20.88
Between 500 and 800 KG25$ 17.504%$ 16.8018%$ 20.65
800 KG or more40$ 17.002%$ 16.6620%$ 20.40

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.

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
}
]

The JSON to be sent consists of an array of objects, where each object can have the following attributes:

NameAttributeRequiredExplanation
Tier namedescricaoNo

Optional attribute.

Used to provide a descriptive name for the tier.

EX: Up to 100 KG, Above 800 KG

Initial quantityqtdeInicialYes

Determines from which product quantity the price applies.

NOTE: We use >= (greater than or equal to) to match the tier based on quantity.

PricevalorUnitarioYes

Determines the unit value of the product.
% Max discountpercDescontoMaximoNo

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 markuppercAcrescimoMaximoNo

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.

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"
}
]