Discounts
POS systems apply discounts in two ways: directly on individual line items, or as a global reduction on the whole order. The Unified API normalises both into a consistent model that always keepstotal_discount coherent with the line totals.
Discount model
Every discount in the API is aDiscountItem object with three fields:
type values
UNKNOWN is the default when the POS does not provide this information. Do not treat it as an error.Line-level discounts
Each order line item (OrderLineItem) exposes a discounts list:
discounts list is informational. The discount amounts are already subtracted from the line total. Do not subtract them again when you compute totals.
A line can carry multiple DiscountItem objects when several promotions apply simultaneously.
Order-level discount
The order fieldtotal_discount holds the total tax-inclusive discount for the entire order:
remaining_global_discount is the part of the order-level reduction that the POS did not assign to any specific line. It is already subtracted from order.total.
When you need to split remaining_global_discount across VAT rates for accounting, see Amounts, roundings and totals — Splitting a global discount.
The general_discount line type
Some POS systems do not use DiscountItem objects. Instead, they emit a dedicated line item of type general_discount to represent the discount:
general_discount lines:
totalis negative — it reduces the order total.discountsis empty on this line type.order.total_discountreflects the absolute value:5.000in the example above.- Treat this line like any other line when summing VAT per rate.
Some orders may combine both patterns: some lines carry
DiscountItem objects while another line is of type general_discount. This depends on the source POS software.