Skip to main content

Overview

An invoice can contain two types of adjustment:
  • Allowances (discounts) decrease the invoice amount.
  • Charges (fees) increase the invoice amount.
You can apply each type at two levels:
  1. Document level: the adjustment applies to the full invoice (for example an early payment discount or a handling fee).
  2. Line level: the adjustment applies to one line item (for example a bulk discount on one product).
The API calculates the totals of the document from the lines, the allowances and the charges. Invoice totals and calculations gives the formulas.

Send the request

All request bodies on this page go to the same two endpoints: POST /api/validate/json (to examine the body) and POST /api/documents/ (to create the document). Only the JSON body changes. The request below creates the basic invoice; replace its body with a body from this page.
Replace the vendor fields with the data of your company. The API rejects a document on create (406) if the Peppol ID of the vendor is not one of the Peppol IDs of your company. The API returns 201 with the document in state DRAFT. The response contains the calculated totals as strings:
Response (shortened)
Validation is not a separate mandatory call. POST /api/documents/ rejects a payload that does not pass the same rules. Use POST /api/validate/json while you develop, because it returns all rule failures and the generated UBL.
Many examples on this page are fragments: they show only the items, allowances or charges part of the body. Add them to a complete document before you send them.

Document-level allowances

A document-level allowance decreases the invoice amount after the line items are added together.

Early payment discount

Calculation:
  • Line items: €1,000.00
  • Allowance: -€50.00
  • subtotal: €950.00
  • total_tax (21%): €199.50
  • invoice_total: €1,149.50

More than one document-level allowance

Calculation with line items of €1,000.00:
  • Volume discount: -€50.00
  • Promotional discount: -€25.00
  • subtotal: €925.00
  • total_tax (21%): €194.25
  • invoice_total: €1,119.25
To state an allowance as a percentage, refer to Percentage allowances and charges.

Document-level charges

A document-level charge increases the invoice amount.

Shipping fee

Calculation:
  • Line items: €1,000.00
  • Charge: +€25.00
  • subtotal: €1,025.00
  • total_tax (21%): €215.25
  • invoice_total: €1,240.25

More than one charge

Combine allowances and charges

One invoice can contain allowances and charges:
Calculation:
  • Line items: €1,000.00
  • Allowance: -€100.00
  • Charge: +€30.00
  • subtotal: €930.00
  • total_tax (21%): €195.30
  • invoice_total: €1,125.30

Line-level allowances

A line-level allowance applies to one line item.
The amount of a line is the net amount of the line: quantity × unit_price, minus the allowances of the line, plus the charges of the line. The API writes amount to the UBL as the line amount, and calculates the document totals from quantity, unit_price and the line allowances and charges. Make sure that the two results are equal.

Discount on one product

Calculation:
  • Line 1: (10 × €100) - €100 = €900.00
  • Line 2: 5 × €50 = €250.00
  • subtotal: €1,150.00
  • total_tax (21%): €241.50
  • invoice_total: €1,391.50
A line-level allowance or charge uses the tax rate of its line. It has no tax category of its own in the UBL.

More than one allowance on one line

Calculation of line 1:
  • Base: 20 × €100 = €2,000.00
  • Volume discount: -€100.00
  • Loyalty discount: -€50.00
  • Line amount: €1,850.00

Line-level charges

A line-level charge applies to one line item.
Calculation of line 1:
  • Base: 1 × €500 = €500.00
  • Special handling: +€50.00
  • Line amount: €550.00

Complete example with the two levels

This invoice uses allowances and charges at document level and at line level:
Line items:
  • Line 1: (20 × €100) - €200 = €1,800.00
  • Line 2: 10 × €50 = €500.00
  • Line 3: €1,000 + €100 = €1,100.00
  • Sum of the lines: €3,400.00
Document level:
  • Allowance: -€150.00
  • Charge: +€50.00
  • subtotal: €3,300.00
  • total_discount: €150.00
Tax and total:
  • total_tax (21% of €3,300.00): €693.00
  • invoice_total: €3,993.00

Tax on allowances and charges

Each document-level allowance and charge has a tax_rate (default 21.00) and a tax_code (default S). The API adds the amount to the tax base of the lines that have the same tax_rate.

Same tax rate

If all lines have one tax rate, use that rate for the allowance or charge:

Different tax rates

If the invoice has more than one tax rate, give each allowance or charge the rate of the lines to which it applies:

Allowances and charges without VAT

For an allowance or charge on items that are exempt from VAT, send tax_rate 0.00 and the applicable tax category code:
An allowance or charge with tax_rate 0.00 changes subtotal but does not change total_tax.

Validation of the result

The API converts the JSON body to a Peppol BIS Billing 3.0 document. The rules of that standard depend on the content of the invoice: the country of the vendor, the document type, the tax category codes and the tax rates. For example, each document-level allowance must have a reason or a reason code, and its tax category must agree with its rate.
Validation is not a separate mandatory call. POST /api/documents/ rejects a payload that does not pass the same rules. Use POST /api/validate/json while you develop, because it returns all rule failures and the generated UBL.
Refer to the validation guide for the response format and to Errors and troubleshooting for the rules that fail most frequently.
Give each allowance and charge a reason that the customer can understand.Clear:
Not clear:
Use the document level when the allowance or charge applies to the full order:
  • Early payment discounts
  • Shipping for the full order
  • Promotional discounts on the full order
Use the line level when it applies to one product:
  • Bulk discount on one product
  • Special handling for a fragile item
  • Promotion on one product
When you calculate an amount from a percentage, round the result to 2 decimals before you send it:
Give each document-level allowance and charge the tax category code and the tax rate of the items to which it applies.
When you give an early payment discount, state the terms in payment_term:

Frequent cases

1

Volume discounts

2

Shipping and handling

3

Loyalty programme discounts

4

Financial charges

Percentage allowances and charges

To state an allowance or a charge as a percentage, send multiplier_factor and base_amount together with amount. multiplier_factor is the percentage (send 10 for 10%; minimum 0, maximum 100, 2 decimals maximum).
The API does not calculate amount from multiplier_factor and base_amount, and it does not compare the three values. You must send amount (base_amount × multiplier_factor / 100, rounded to 2 decimals).
Totals that the API calculates: subtotal 900.00, total_discount 100.00, total_tax 189.00, invoice_total 1089.00. A charge accepts the same three fields (multiplier_factor, base_amount, amount).

Allowance reason codes

The reason_code of an allowance accepts these UNCL5189 codes (send the code as a string): The reason_code of a charge accepts the UNCL7161 codes. The full list is in the ChargeReasonCode schema of the API reference.

Next Steps

Invoice totals and calculations

Read how the API calculates and examines the totals

Create credit notes

Create credit notes with allowances

Validation during development

Examine complex invoices while you develop

LineItem

See all fields of a line item, an allowance and a charge