# Why does KSeF accept an invoice that's wrong?

Source: https://xmlvalid.com/blog/why-does-ksef-accept-a-wrong-invoice

> KSeF checks the FA(3) schema, NIP check digits and duplicates, not the amounts. The Ministry's own example broken fifteen ways, and what each mistake gets back

KSeF, Poland's National e-Invoicing System, gives an invoice a KSeF number once the file passes its checks. The Ministry of Finance lists those checks in its KSeF 2.0 documentation ("Weryfikacja faktury", 9 April 2026): the file must be well-formed XML in UTF-8 and match the FA(3) schema, it may not carry processing instructions or certain Unicode characters, the NIP numbers must have valid check digits, the invoice number must not repeat for the seller, and the issue date must not be later than the day KSeF receives the file. That is the whole list. Nothing on it adds up an amount.

So an invoice whose total doesn't match its lines, a euro invoice without its tax in złoty, or a correction that doesn't say what it corrects, gets a KSeF number like any other. It is still a wrong invoice under the VAT Act, and the buyer's accounting team or a tax inspector is the one who finds out.

To show what that covers, I took the Ministry's own example 1 from its FA(3) sample files, a basic VAT invoice for a fridge, carrying it in and a bottle of milk, which passes every check, and broke it in fifteen ways. Every message below is what xmlvalid's [KSeF rules](https://xmlvalid.com/e-invoicing/poland) report on the broken file.

## What KSeF itself rejects

Three of the checks on the Ministry's list are about the file's content, and a schema can't do them.

A template that adds a stylesheet for display, `<?xml-stylesheet type="text/xsl" href="faktura.xsl"?>`, makes the file unacceptable to KSeF, which takes no processing instructions:

```
XV-PL-01  KSeF rejects an invoice with an XML processing instruction (xml-stylesheet); leave out instructions such as xml-stylesheet (KSeF 2.0, weryfikacja faktury).

```

Some characters are refused too: the C1 control characters, among others. They get in through encodings. The euro sign is byte `0x80` in Windows-1252; text from such a system read as ISO-8859-1 turns it into U+0080, a control character most editors don't show. Add "dopłata 10 €" to the example's delivery note that way:

```
XV-PL-02  KSeF rejects an invoice with a discouraged Unicode character: U+0080 in Wartosc (KSeF 2.0, weryfikacja faktury).

```

The third is the NIP. Its tenth digit is the sum of the first nine weighted 6, 5, 7, 2, 3, 4, 5, 6, 7, modulo 11; a remainder of 10 means no such NIP exists. The example's buyer has `1111111111`, which is valid. Change the last digit:

```
XV-PL-03  The NIP 1111111112 of Podmiot2 has no valid check digit; KSeF's production environment rejects the invoice (KSeF 2.0, weryfikacja faktury).

```

This one is a trap: the Ministry's documentation says the NIP check applies in the production environment only. An integration tested against KSeF's test environment with made-up NIPs passes there and is rejected on the first real invoice.

## The total and the sums per rate

FA(3) doesn't carry a VAT breakdown block. It has a pair of fields for each rate, `P_13_1` (net at 23 %) with `P_14_1` (its tax), `P_13_3` with `P_14_3` for 5 %, and so on, and `P_15`, the amount due. The example's are:

```xml
<P_13_1>1666.66</P_13_1>
<P_14_1>383.33</P_14_1>
<P_13_3>0.95</P_13_3>
<P_14_3>0.05</P_14_3>
<P_15>2051</P_15>

```

`P_15` is their sum. Write 2051.10:

```
XV-PL-12  P_15 (2051.10) must be the sum of the net amounts P_13_1 to P_13_11 and the tax P_14_1 to P_14_5 (2050.99) (FA(3) information sheet, P_15).

```

The sum is 2050.99, not 2051: the Ministry's example is itself a grosz off. The seller started from gross prices (2,000 for the fridge, 50 for carrying it in, 1 for the milk) and a grosz went missing when they were turned into net ones. The rule allows one grosz either way for that reason; anything more is an error.

Each rate's sum is the sum of its lines. Line 2, carrying in, is one service at 40.65. Type 46.65 as its value and leave the rest:

```
XV-PL-14  The sums per rate do not match the lines: P_13_1 1666.66 (lines: 1672.66). Each P_13 field is the sum of the net values (P_11) of the lines at its rate, or of their gross values (P_11A) less the tax (FA(3) information sheet, P_13_1, P_11).
XV-PL-36  Line 2: P_11 (46.65) is not the quantity times the unit price, less any discount (P_10), which is 40.65 (FA(3) information sheet, P_11).

```

Two findings, one cause: fix the line. The second is a warning, because a line can have reasons to differ from quantity × price by more than rounding; the Ministry's example 4 reads its discount `P_10` per unit, the field's description doesn't say whether per unit or per line, and the rule accepts both.

The other common slip is the wrong field for a rate. Put the milk (5 %) into the 8 % fields, `P_13_2` and `P_14_2`:

```
XV-PL-14  The sums per rate do not match the lines: P_13_2 0.95 (lines: 0); P_13_3 0 (lines: 0.95). Each P_13 field is the sum of the net values (P_11) of the lines at its rate, or of their gross values (P_11A) less the tax (FA(3) information sheet, P_13_1, P_11).
XV-PL-13  The tax is not the rate applied to its net amount: P_14_2 0.05 on P_13_2 0.95 (rates 23 or 22, 8 or 7, 5 %; per line rounding allowed) (FA(3) information sheet, P_14_1).

```

The same happens to zero-rated sales, where it is easier to miss: a set of FA(3) sample invoices on GitHub puts an export (`0 EX`, field `P_13_6_3`) into the intra-Community supply field `P_13_6_2`. Both are 0 %, the total is right and KSeF takes it; the buyer's VAT records get the wrong kind of sale.

The tax per rate (`XV-PL-13`) is a warning rather than an error. The VAT Act lets a seller compute VAT on the total of a rate or line by line, and the second can be a few grosze off the first, so the rule allows half a grosz per line on top of one grosz.

## Invoices in another currency

The amounts of an invoice in euros are in euros, but the VAT Act (art. 106e ust. 11) wants the tax in złoty too. FA(3) has fields for it, `P_14_1W` to `P_14_4W`. Change the example's currency to `EUR`:

```
XV-PL-11  An invoice in EUR must give its tax in PLN as well; missing: P_14_1W, P_14_3W (VAT Act, art. 106e ust. 11; FA(3) information sheet, P_14_1W).

```

And the other way, a template that always writes the converted tax produces it on a złoty invoice too:

```
XV-PL-10  An invoice in PLN has no converted tax (P_14_1W); those fields are for an invoice in a foreign currency (FA(3) information sheet, P_14_1W).

```

## The kind of invoice

`RodzajFaktury` says what the invoice is, and each kind needs something the others don't. The schema can't tie them together, so all of these pass KSeF.

A simplified invoice (`UPR`) may leave out the buyer's name and address, and only up to PLN 450 or EUR 100 due. Mark the example, at PLN 2,051, as one:

```
XV-PL-22  A simplified invoice (UPR) may be issued up to PLN 450 or EUR 100 due; P_15 is 2051 PLN (VAT Act, art. 106e ust. 5 pkt 3).

```

A corrective invoice (`KOR`) names the invoice it corrects, with its date, number and KSeF number, in `DaneFaKorygowanej`:

```
XV-PL-15  A corrective invoice (KOR) must name the invoice it corrects in DaneFaKorygowanej (VAT Act, art. 106j ust. 2; FA(3) information sheet, DaneFaKorygowanej).

```

A correction that shows lines before and after (`StanPrzed`) gives the line before the same number as the line after; the Ministry's correction examples do exactly that, so two lines with one number are fine there and nowhere else.

An advance invoice (`ZAL`) describes the order it is paid on, with its value, in `Zamowienie`:

```
XV-PL-19  An advance invoice (ZAL) must describe the order or contract and its value in Zamowienie (VAT Act, art. 106f ust. 1 pkt 4; FA(3) information sheet, Zamowienie).

```

The final invoice after advances (`ROZ`) lists them in `FakturaZaliczkowa` (`XV-PL-18`), and the order's value is the sum of its lines with tax (`XV-PL-21`).

## The notes the Act requires

`Adnotacje` holds the notes an invoice must carry, each a 1 or a 2 (or a single 1 in a choice). The schema makes sure there is an answer, not that it is the right one.

Sell the milk as exempt (`zw`, with its amount in `P_13_7`) and leave `P_19N` (no exemption) as it was:

```
XV-PL-27  An invoice with exempt sales (P_13_7 or a line at rate zw) must give the legal basis of the exemption: P_19 1 with P_19A, P_19B or P_19C (VAT Act, art. 106e ust. 1 pkt 19; FA(3) information sheet, P_19).

```

Split payment is the costly one. An invoice over PLN 15,000 due to a VAT taxpayer, for goods or services listed in Annex 15 of the Act, must carry the note "mechanizm podzielonej płatności", `P_18A` 1. FA(3) lets each line say it is an Annex 15 item, `P_12_Zal_15`. Turn the fridge into ten laptops, which are on the list, with `P_12_Zal_15` set and `P_18A` left at 2:

```
XV-PL-29  An invoice over PLN 15,000 due (P_15 20050.92) to a taxpayer, with goods or services of Annex 15 (P_12_Zal_15), must carry the split payment note: P_18A 1 (VAT Act, art. 106e ust. 1 pkt 18a; FA(3) information sheet, P_18A).

```

The same goes for reverse charge (`oo` lines without `P_18` 1, `XV-PL-28`) and the margin scheme (`P_13_11` without `P_PMarzy`, `XV-PL-26`).

## The buyer and who else receives it

Only a simplified invoice may name the buyer by NIP alone. Remove the buyer's name from the example:

```
XV-PL-23  An invoice other than a simplified one must give the buyer's name and address (Podmiot2: Nazwa and Adres); only a simplified invoice (UPR) up to PLN 450 may name the buyer by NIP alone (VAT Act, art. 106e ust. 1 pkt 3; FA(3) information sheet, Podmiot2).

```

When the buyer is a local government (a gmina, say) and the invoice is for one of its units, such as a school, `JST` is 1 and the unit appears as `Podmiot3` with role 8, so that KSeF delivers the invoice to it too:

```
XV-PL-24  JST 1 (the invoice concerns a subordinate local government unit) needs that unit in Podmiot3 with Rola 8, so that it receives the invoice in KSeF (FA(3) information sheet, JST).

```

A member of a VAT group works the same way, with `GV` 1 and role 10 (`XV-PL-25`).

## What no check on the file can see

Some of KSeF's own checks need KSeF. A second invoice with the same seller NIP, kind and number is a duplicate (error 440), for ten years after the year it was issued. The sender needs permission to issue invoices for the seller. The file may be at most 1 MB, or 3 MB with attachments, which in turn need the option registered in e-Urząd Skarbowy and a batch session. And `P_1` may not be later than the day KSeF receives the file. A validator that runs before sending can warn about an attachment (`XV-PL-05`) but can't know the rest.

Beyond KSeF, nothing in the file says whether the buyer's VAT number is active, whether the rate fits the goods, or whether the laptops are really laptops.

## A short checklist

| You see | Usually |
|---|---|
| `XV-PL-01`, `XV-PL-02` | A stylesheet instruction from a template, or text from another encoding |
| `XV-PL-03` | A NIP with a typo or a made-up test NIP; fails in production only |
| `XV-PL-12` | `P_15` not the sum of the rate fields |
| `XV-PL-14` with `XV-PL-36` | A line whose value is not quantity × price |
| `XV-PL-14` alone | A rate's sum in the wrong field, such as export in the WDT field |
| `XV-PL-10`, `XV-PL-11` | Converted tax missing on a foreign currency invoice, or present on a PLN one |
| `XV-PL-15` to `XV-PL-22` | The kind of invoice and its elements don't fit together |
| `XV-PL-26` to `XV-PL-29` | A note the sale needs (exemption, reverse charge, margin, split payment) |
| `XV-PL-23` to `XV-PL-25` | The buyer's name and address, a JST unit or a VAT group member missing |

Every rule has a page with what it checks: [XV-PL-03](https://xmlvalid.com/rules/XV-PL-03), [XV-PL-12](https://xmlvalid.com/rules/XV-PL-12), [XV-PL-14](https://xmlvalid.com/rules/XV-PL-14), [XV-PL-29](https://xmlvalid.com/rules/XV-PL-29) and the rest of the [KSeF rule set](https://xmlvalid.com/rules/sets/pl-ksef-xv).

## Check before you send

The [KSeF FA(3)](https://xmlvalid.com/schemas/ksef-fa-3) entry in the catalog runs the Ministry's schema and then these rules; open your invoice in the [validator](https://xmlvalid.com/validate?schema=ksef-fa-3). They are ours, written after the Ministry's documentation, not the Ministry's, and its 26 FA(3) example files pass them. Everything runs in the browser, so the invoice is not uploaded. The [Poland page](https://xmlvalid.com/e-invoicing/poland) has the dates of the mandate, and an invoice you only need to read opens in the [KSeF viewer](https://xmlvalid.com/pl/wizualizacja-faktury-ksef).

### More from the blog

- [XRechnung vs ZUGFeRD: what's the difference?](https://xmlvalid.com/blog/xrechnung-vs-zugferd)
- [Checking the XRechnung your Laravel app writes, in its tests](https://xmlvalid.com/blog/xrechnung-checks-in-laravel-tests)
- [Why does my Peppol invoice fail validation?](https://xmlvalid.com/blog/why-does-my-peppol-invoice-fail-validation)
- [Croatian KPD codes change on 1 January 2027](https://xmlvalid.com/blog/croatian-kpd-codes-in-2027)
- [Why does my French e-invoice fail the BR-FR rules?](https://xmlvalid.com/blog/why-does-my-french-e-invoice-fail-br-fr-rules)
