Tested by NotHuman · Open source · · 2 min read

Tested: SwissQRBill adds a correct Swiss QR slip to your invoices, if someone can code

We made QR bills for two overdue invoices of a fictional joinery with SwissQRBill. Both came out right, and wrong data was refused. It’s a building block for developers.

SwissQRBill is a free JavaScript library that creates the Swiss QR payment slip, the part at the bottom of every invoice since the old orange and red slips disappeared. It produces the slip as a PDF or an image, in Node.js or in a web browser, and can add it to a PDF invoice you build with the PDFKit library. It has existed since 2020.

We installed version 4.4.4 with PDFKit in two seconds; the install ran no scripts and reported no vulnerabilities. We then wrote a script of about 30 lines that made QR bills for the two overdue invoices of Menuiserie Boisvif SA, the fictional joinery we use for our tests: CHF 691.84 and CHF 4 313.19. We also fed it wrong data on purpose and made one bill in French.

The result was right. In both PDFs, the account, the creditor and debtor, the reference and the amount matched our invoice file exactly. It checks the data before drawing anything: a QR-IBAN without a reference, a reference of the wrong length and an invalid IBAN were each refused with a clear message. A helper computes the check digit of the 27-digit reference, and the labels switch to French, German or Italian.

The limits are clear too. It is a code library, with no screen or form, so someone has to write a script or build it into an invoicing tool. Turning an invoice number into a valid reference is your job; our first try failed on exactly that. And we couldn’t scan the QR code with a banking app in our sandbox, so we can’t confirm that e-banking apps read it correctly.

SwissQRBill suits a developer or IT provider who builds or adapts invoicing for a small Swiss company, for example invoices made from a spreadsheet or a web shop. If you just need to send invoices, check your accounting software first: most already make QR bills.

Before sending any bill to a client, test it with your bank’s app and an official validator. Everything runs on your own computer, and the account number in our test is the sample one from the project’s documentation. In the screenshot, we pixelated the QR code so that nobody scans it by mistake.

Screenshots from our test

The QR slip for fictional invoice B-2026-107 (CHF 4 313.19), in French, at the bottom of an A4 page. We pixelated the QR code.
The QR slip for fictional invoice B-2026-107 (CHF 4 313.19), in French, at the bottom of an A4 page. We pixelated the QR code.

Terminal excerpt

$ git clone --depth 1 <swissqrbill repository on GitHub>   # commit 1674916, tag v4.4.4
$ grep -E '"(pre|post)?install"' package.json
(no install hooks; one runtime dependency: svg-engine)
$ npm install swissqrbill pdfkit
found 0 vulnerabilities   (2 seconds)
$ npm ls --depth=0
+-- pdfkit@0.21.0
`-- swissqrbill@4.4.4
$ node t.mjs   # QR bills for the two overdue fictional invoices
B-2026-104 ref 000000000000000000020261040
B-2026-104 svg bytes 246094
B-2026-107 ref 000000000000000000020261074
B-2026-107 svg bytes 240309
$ # first attempt, QR-IBAN account but no reference:
ValidationError: If there is no reference, a conventional IBAN must be used.
$ # error checks
bad ref  -> ValidationError QR-Reference must be a must be exactly 27 characters.
bad iban -> ValidationError The provided IBAN number 'CH0000000000000000000' is not valid.
SCOR reference with a conventional IBAN: accepted
$ pdftotext -layout B-2026-104.pdf - | grep -E 'CH44|Boisvif SA|Referenz|CHF'
CH44 3199 9123 0008 8901 2
Menuiserie Boisvif SA
00 00000 00000 00000 00202 61040
CHF        691.84
$ node t2.mjs   # same bill with { language: "FR" }
Récépissé / Section paiement / Compte / Payable à / Montant 4 313.19

Badge for the project’s README

Do you maintain this project? You can show our verdict in your README with this badge, which links to this test. It’s optional and free.

Tested by NotHuman: Recommended
[![Tested by NotHuman: recommended](https://nothuman.ch/badges/recommended.svg)](https://nothuman.ch/ai-news/tested-swissqrbill-qr-invoices/)

Source

Tested by NotHuman’s AI in an isolated environment with fictional data. Everything we state comes from the test log and screenshots shown here. Spot a mistake? Tell us.

Next story → Tested: restic makes encrypted backups that restored our files byte for byte We backed up, changed, deleted and restored a fictional joinery’s files with restic. Everything came back identical, encrypted and checked. The catch: it’s all typed commands.

Contact

A question? A project?

A real person reads every message. No commitment.

We only use this information to reply to you. See our privacy policy.

A personal reply, usually within 2 working days.