In this article, you will learn how to transmit discounts and surcharges to the RetailForce Middleware.
Prerequisits
- Basic experience with the RetailForce document model
Information
Supported discounts and surcharges
Currently, discounts and surcharges can be transferred in the document payload as follows:
- As part of the individual item position and thus as a discount or surcharge for the respective item
- Within a position of type “Total” (Note: See below for special considerations)
- As a separate discount/surcharge position
Note: Option 2 may not be supported in every country. See FiscalCountryProperties for the respective country.
The transfer of discounts/surcharges on all item positions via subtotals or totals is currently not supported. All discounts and surcharges must be converted to all positions.
However, multiple discounts or surcharges can be transferred per item.
Important: The sum of all discount values or surcharges per item must equal the difference between "GrossValue" and "BaseGrossValue", otherwise validation will fail.
Possible transfer of discounts and surcharges
Variant 1
Discounts or surcharges are included in the respective item position in the “Discounts” array.
Example:
The following example shows only an excerpt and not the complete item position.
"BaseNetValue": 123.08,
"BaseGrossValue": 147.70,
"BaseTaxValue": 24.62,
"VatIdentification": 1,
"VatPercent": 20.0,
"Discounts": [
{
"DiscountValue": 14.7700,
"Caption": "Regular customer discount 10%",
"DiscountOrder": 0,
"Type": 1,
"TypeValue": 10,
"PromotionKeys": null,
"Identifier": "SKR-10"
}
],
"NetValue": 110.78,
"GrossValue": 132.93,
"TaxValue": 22.16,Details on the individual elements can be found in the article Position-object “positions”.
In the example above, a discount of 10% ("TypeValue: 10") is applied. The "DiscountValue" is calculated from the "BaseGrossValue" (value before discount). To calculate the "GrossValue", the "DiscountValue" is subtracted from the "GrossValue".
Surcharges
When transferring surcharges, please note the following:
- "DiscountValue" and "TypeValue" are NEGATIVE values in the case of surcharges!
Types of discounts and surcharges
"Discounts.Type" specifies the type of discount or surcharge:
| Type | Description | Element |
| discount / surcharge as sum |
The discount/surcharge is specified as a fixed value, e.g., "15 EUR discount" or "5 EUR service fee". In this case, "DiscountValue" and "TypeValue" have the same value. |
"Type": "[0] = Allowance" or: "Type": 0 |
| percentage discount/surcharge |
The surcharge/discount is specified as a percentage value, e.g., "10% discount on items" or "5% service fee". Here, "TypeValue" specifies the percentage value, whereby "DiscountValue" is calculated from the respective "BaseGrossValue" of the item. Note: In the case of percentage discounts, "DiscountValue" must always be calculated to 4 decimal places! |
"Type": "[1] = Discount" or: "Type": 1 |
Multiple discounts/surcharges
The "Discounts" array can contain multiple discounts/surcharges.
The order in which individual discounts or surcharges are applied to calculate the "GrossValue" is defined by "DiscountOrder", with the first discount to be applied having the value '0'.
Example of multiple discounts:
In the following example, a percentage discount of 10% is first applied to an item, followed by a discount of EUR 5.
"BaseNetValue": 123.08,
"BaseGrossValue": 147.70,
"BaseTaxValue": 24.62,
"VatIdentification": 1,
"VatPercent": 20.0,
"Discounts": [
{
"DiscountValue": 14.7700,
"Caption": "Regular customer discount 10%",
"DiscountOrder": 0,
"Type": 1,
"TypeValue": 10,
"PromotionKeys": null,
"Identifier": "SKR-10"
},
{
"DiscountValue": 5.0000,
"Caption": "Special discount 5 EUR",
"DiscountOrder": 1,
"Type": 0,
"TypeValue": 5.0,
"PromotionKeys": null,
"Identifier": "SKR-10"
}
],
"NetValue": 106.61,
"GrossValue": 127.93,
"TaxValue": 21.32,Special characteristic “Total” position
Discounts or surcharges can also be transferred as part of a "Total" item (sum item).
However, it should be noted that simply specifying this within the "Total" item is NOT sufficient. The discount must be distributed proportionally among the individual item positions. For example, if a 10% discount is shown on the total item, the individual items must also show a 10% discount.
Example:
{
"PositionNumber": 1,
"Type": 10,
"Rounding": null,
"BaseValue": 147.70,
"Value": 132.93,
"Discounts":[
{
"Identifier": "SKR-10",
"Caption": "Regular customer discount 10%",
"Type": 1,
"DiscountOrder": 0,
"DiscountValue": 14.7700,
"TypeValue": 10
}
],
"Caption": "Summe"
}
Variant 2
In most countries, discounts and surcharges can also be transferred as separate items. The discount or surcharge is taken into account as part of the calculation of the document total.
Discounts are transferred as negative values, surcharges as positive values!
Such discounts or surcharges are defined via the "BusinessTransactionType": "[1] = Discount".
Example:
In the following example, a discount of EUR 12 is shown as a separate item..
{
"PositionNumber": 1,
"Type": 3,
"Caption": "Discount",
"Identifier": "Discount",
"BusinessTransactionType": 1,
"VatIdentification": 1,
"VatPercent": 20.0,
"NetValue": -10.0,
"GrossValue": -12.0,
"TaxValue": -2.0
}
Comments
0 comments
Please sign in to leave a comment.