One invoice per payment
The payment ID works as a key that prevents a second invoice, and the invoice number is claimed in a single, indivisible operation. A repeated gateway notification or a parallel background job will not issue another invoice.
Online payment, confirmation and an invoice in KSeF, Poland’s national e-invoicing system, with no manual work. A shared settlement module running in production in three applications.
In production in three applications: Translate in Context / XL8, Let’s Play a Gig / Koncertuj and Feel at Home / Zadomo.
Our own Localize.pl project, not client work.
An application that takes online payments in Poland must issue a valid FA(3) invoice in KSeF, the national e-invoicing system, after every successful payment. It must not issue it twice, and it must not issue it when the payment did not go through.
Instead of writing this three times, we built one module for three applications.
The payment ID works as a key that prevents a second invoice, and the invoice number is claimed in a single, indivisible operation. A repeated gateway notification or a parallel background job will not issue another invoice.
The module compares the amount from the gateway with the invoice lines. If they differ, no invoice is created.
A company invoice cannot be built from hand-typed data: the code requires the result of a tax ID (NIP) check, so a version without it simply will not compile.
Business and consumer invoices and corrections, including cross-border rates (intra-EU supply, export, reverse charge), validated against the official XSD schema.
The Autopay integration accepts ITN notifications with signature checks and handles refunds. Payment status comes from the gateway server, not from a browser redirect.
| Technology | Role |
|---|---|
| TypeScript, Node.js | KSeF module with no runtime dependencies |
| KSeF 2.0 (API v2), FA(3), XSD | Issuing and validating invoices |
| Autopay | Payments, ITN notifications and refunds |
| Automated tests | Business and consumer invoices, corrections, retries |
The KSeF module and the Autopay integration run in production in all three applications. The KSeF module is a shared, versioned package with automated tests, while the Autopay integration has a separate implementation in each application. Examples on this page contain no real company or buyer data.
As of 28 September 2026.
Tell us about your process. We will check whether a similar approach makes sense for you.
Book a consultation→