Calculation of line item and order amounts

The purpose of this guide is to provide a thorough description of how to calculate gross_amount, net_amount, tax_amount etc. from the line_item level to the order level, in order to avoid validation errors when integrating with our endpoints.

General rules

Line item level

  • line_item.net_amount = line_item.quantity * line_item.unit_price - line_item.discount_amount
  • line_item.tax_amount = line_item.net_amount * line_item.tax_rate
  • line_item.gross_amount = line_item.net_amount + line_item.tax_amount

Order level

  • order.net_amount = SUM(line_item.net_amount), i.e. SUM(line_item.quantity * line_item.unit_price - line_item.discount_amount)
  • order.tax_amount = SUM(line_item.tax_amount), i.e. SUM(line_item.net_amount * line_item.tax_rate)
  • order.gross_amount = SUM(line_item.gross_amount), i.e. SUM(line_item.net_amount + line_item.tax_amount)

Note: If the amounts are calculated with the gross amounts as the foundation instead of the unit price, the calculations are more prone to rounding errors which in turn will cause validation errors

PEPPOL validation rules, rounding and tolerance

Note: This section is most relevant for NO and SE merchants, but in order to ensure correct calculations we encourage you to follow the recommendations.


line_item.tax_amount = (line_item.unit_price line_item.quantity - line_item.tax_rate. Deviation tolerance 0.02

When tax_subtotals is included (independent of region)

line_item.net_amount = line_item.unit_price * line_item.quantity - line_item.discount_amount. Deviation tolerance 0.02

order.tax_subtotals.tax_amount = line_item.tax_rate * line_item.net_amount, Rounded to 2 decimal places. Deviation tolerance 1.00

Amount description summary

  • line_item.unit_price : Price per unit without tax
  • line_item.quantity : Number of units
  • line_item.discount_amount : Line item level discount without tax. Discounts are not set on unit level
  • line_item.net_amount : Amount after discounts and before taxes
  • line_item.tax_amount : net_amount multiplied by the tax_rate
  • line_item.gross_amount : tax_amount added to the net_amount