# Amounts that are not a whole cent: SDK 6.8.3 and the API round them the way the document shows them

> A line such as 0.5 × 2.99, or a charge of 0.015, is now rounded to the cent once, and every total adds up the rounded amounts. POST /v1/invoices no longer refuses these lines, and @getpeppr/sdk 6.8.3 no longer builds UBL whose totals contradict its lines.

- Published: 2026-11-24
- Language: English (en)
- Page: https://getpeppr.dev/news/2026-11-24-sdk-6-8-3-line-net-rounding/
- Publisher: getpeppr (Zero Loop Labs Ltd)

A line net amount is `quantity × unitPrice / baseQuantity`, minus line
allowances, plus line charges. When that is not a whole cent — `0.5 × 2.99`
is `1.495`, `3 × 9.99 / 2` is `14.985` — the Peppol rules allow at most two
decimals on the line (EN 16931 rule `BR-DEC-23`) and require the document
totals to add up the lines as written (`BR-CO-10`). Allowance and charge
amounts have the same two-decimal limit.

## `POST /v1/invoices`

getpeppr sent such a line unrounded, and the network provider refused the
document. The API answered `422` with the generic message
`Invoice validation failed. Check the request body for missing or invalid fields.`

Each line is now rounded to the cent before it is sent, and so is every
allowance, charge, prepaid and rounding amount: a charge of `0.015` is sent as
`0.02`. The line is computed from the quantity and the price as the document
writes them, with at most 6 and 8 decimals. The VAT breakdown and the totals
add up these rounded amounts. A line allowance or charge worth `0.00` is no
longer sent, because the provider refuses it; it changes no amount.

A credit note now credits exactly what the same lines bill on an invoice, VAT
included: a `14.985` line becomes `14.99` on both, and VAT of `1.785`
(`8.50` at 21 %) becomes `1.79` on both. Before, the credit note carried
`1.78`, one cent below the invoice and below the total getpeppr records for
the document. This applies to credit notes with whole-cent lines too, whenever
a VAT amount falls exactly on a half cent.

## `@getpeppr/sdk` 6.8.3

`buildInvoiceXml()` and `buildCreditNoteXml()` rendered each line rounded,
but added up the unrounded values for the totals. Measured on 6.8.2:

| Document | 6.8.2 | 6.8.3 |
|---|---|---|
| two lines of `0.5 × 2.99` | lines `1.50` + `1.50`, line total `2.99`, payable `3.62` | lines `1.50` + `1.50`, line total `3.00`, payable `3.63` |
| one line of `3 × 9.99 / 2` | line `14.98`, line total `14.98`, payable `18.14` | line `14.99`, line total `14.99`, payable `18.14` |

The Peppol rules refuse both 6.8.2 documents, invoice or credit note: the
first breaks `BR-CO-10`, the second `BR-CO-13`. Neither 6.8.3 document breaks
any fatal rule.

6.8.3 also:

- computes each line from the quantity and the price as written: the quantity
  with at most 6 decimals, as before, and the price with at most 8. The price
  used to be cut to 2 decimals (`1.035` written `1.03`), and a quantity with
  more decimals counted in full while written `0.012345`, so the check of the
  line against its quantity and price (`PEPPOL-EN16931-R120`) used values the
  line did not;
- rounds every allowance and charge amount, and the prepaid and rounding
  amounts, to the cent before using them. A document charge of `0.015` was
  written `0.01` but counted as `0.015`; a prepaid amount of `0.115` was
  written `0.12` but subtracted as `0.115`;
- writes the allowance and charge totals whenever an allowance or charge is
  present, even at `0.00`;
- writes a line whose net is exactly zero as `0.00`, never `-0.00`.

`computeUblMonetaryAmounts()` follows the same rules, so it returns the totals
the XML shows. Documents in which every line amount
(`quantity × unitPrice / baseQuantity`, minus allowances, plus charges) is
already a whole number of cents, with quantities of at most 6 decimals and
whole-cent prices, allowances, charges, prepaid and rounding amounts, keep the
same amounts as in 6.8.2. Any other document can change, as in the table
above. No type or export changes. Requests are unchanged except the default `User-Agent`, which now
says `getpeppr-sdk/6.8.3`.

```bash
npm install @getpeppr/sdk@6.8.3
```
