QR codes for business
The QR code on a KSeF invoice — what is in it and what it proves
What the QR code on a Polish e-invoice actually contains, how the first code differs from the second, and how to spot one that leads somewhere it should not.
5 min read
Polish invoices now carry a QR code. It is not decoration and it holds no amount to pay — it leads to an address where you can check whether that invoice really reached the national e-invoicing system, KSeF.
It is worth knowing what is inside it, because this is the code that gets swapped on fraudulent invoices.
The first code: verifying the invoice
The first code is on every invoice, whatever mode it was issued in. It holds an address built from four parts:
https://qr.ksef.mf.gov.pl/invoice/{seller's NIP}/{DD-MM-YYYY}/{digest of the invoice file}
- The seller's NIP — ten digits, from the invoice's Podmiot1 field.
- The issue date — field
P_1, as day-month-year. - The digest of the invoice file — a SHA-256 hash of the file, written in Base64URL.
The digest is the important part. It ties the code to the particular contents of the document: change one digit of an amount and the digest changes completely, so the code no longer matches the invoice it is printed on.
Under the code, the invoice's KSeF number is printed — or the word OFFLINE if no number has been assigned yet.
The second code: verifying the issuer
The second code appears only on invoices issued offline and is labelled CERTYFIKAT. It holds the serial number of the issuer's KSeF certificate and a signature made with that certificate's private key.
So it confirms who issued the invoice, not that the invoice has reached the system. These are two different claims and they are easy to conflate.
How to spot a code that leads somewhere else
The Ministry of Finance publishes exactly three addresses:
| Service | Address |
|---|---|
| Production | qr.ksef.mf.gov.pl |
| Pre-production | qr-demo.ksef.mf.gov.pl |
| Test | qr-test.ksef.mf.gov.pl |
Any other address is not a KSeF address, however similar it looks and however many times it contains "ksef" and "gov". A QR code on paper does not show where it leads until you scan it — which is the whole problem.
Our code reader takes such a code apart and checks the domain. If the address is not one of the three above, we show it as text, with no link to click, and say so plainly.
What the code does not prove
A well-formed QR code does not mean the invoice is genuine. It means somebody built an address to the right pattern. The proof is the page that address opens: if the Ministry's system shows an invoice with that digest, from that tax number, on that date, that is confirmation. The code by itself is not.
The same goes for the bank account. A KSeF code contains no account number and says nothing about one — the account for payment comes from the body of the invoice, and that is what is worth checking against what you know about the supplier.
In short
- The QR code on an invoice leads to verification in KSeF, not to a payment.
- It contains the seller's tax number, the issue date and a digest of the invoice file.
- A second code, labelled
CERTYFIKAT, concerns the issuer and appears only in offline mode. - The only genuine addresses are
qr.ksef.mf.gov.pland its demo and test counterparts. - The proof is the page the code opens, not the code itself.
Issuing modes and the number of codes
How many codes an invoice carries depends on how it was issued.
Online mode, the ordinary one: the invoice reaches the system straight away and gets a KSeF number. The printout then has one code — the verification code — with the KSeF number under it.
Offline modes, meant for an outage or a lost connection: the invoice is created and reaches the buyer before it reaches the system. There is no KSeF number yet, so the word OFFLINE is printed under the first code, and a second code, labelled CERTYFIKAT, appears next to it.
The practical conclusion for whoever receives the invoice is that two codes are not a sign that something is wrong. They mean an invoice issued without a live connection to the system, which is foreseen and allowed.
What to do when verification does not confirm the invoice
There are three different situations, and they are worth telling apart, because each leads somewhere else.
The page does not find the invoice, and the code leads to the right address. For an invoice issued offline that is normal until the document reaches the system. For an online invoice, ask the issuer before you pay.
The code leads to an address other than the official one. That is a serious signal. No genuine KSeF invoice leads outside the domains listed above. Do not open the address, and contact the supplier through a channel you already know — by phone, on a number from earlier correspondence, not from this invoice.
The code does not scan at all. That is usually the quality of the print or the scan. Try a close-up photo in better light. If the code is damaged, the invoice can be verified without it — the KSeF number alone is enough.
Does the code replace the invoice
No. The QR code is an addition to the visual form of the invoice, not the invoice itself. The document, as far as the system is concerned, is the structured file in KSeF; what you receive on paper or as a PDF is a representation of it.
That is why the code holds no amount, no items and no account number — it holds exactly as much as it takes to point to the right document in the system and to confirm that its content has not changed.
If you are looking for a code that makes paying easier, that is something else entirely: it holds the account number and the amount, and the guide to the transfer QR code describes it. Both codes can appear on one invoice, and they do different things.
Where to find reliable information
The rules of KSeF are set by the Polish Ministry of Finance, and its documentation is the only source worth basing decisions on. Write-ups on the internet contradict each other: while writing this article we came across at least three different versions of the verification address and two different versions of the standard for the QR code itself.
That is why everything described above comes from the Ministry's documentation repository, and the date we read it is given under the article. If you are reading this much later, check the source — we do not refresh it automatically.
Sources
Where we state a price, a date or a standard, we say where it came from and when we checked it. Sources change without our involvement.