KSeF in a system for wedding venues - invoices reach the tax authority on their own and come back numbered

Every invoice issued in the system goes to KSeF on its own and comes back with a KSeF number and an official receipt (UPO). Once a day the system fetches supplier invoices from KSeF and links them to kitchen orders.

Client profile
A SaaS system for wedding venues: bookings, events, kitchen, lodging, payments
My role
Designing and building an in-house KSeF 2.0 client, invoice sending and cost invoice import
Status
Tested on the KSeF test environment

This description is anonymous: no client name, data or screenshots.

Context

A wedding venue issues a lot of invoices: advance invoices, final invoices, corrections, guest lodging bills. Since 2026, invoices in Poland go through KSeF, the National e-Invoicing System run by the Ministry of Finance. Uploading them by hand is extra work for the office and a risk that an invoice gets stuck and nobody notices until an audit or a call from a client.

Solution

I wrote an in-house KSeF 2.0 API client, with no intermediary and no subscription to an external invoicing service. The venue enters its KSeF token once, in the settings. The token is stored encrypted and never goes back to the browser.

An issued invoice goes straight into a queue. Every 5 minutes the system signs in to KSeF, sends all waiting invoices in one encrypted session, receives the KSeF number and the UPO (the official receipt) and stores them with the invoice next to its XML file. When KSeF does not respond, the system retries after 5, 15 and 60 minutes, then every 6 hours. When KSeF rejects an invoice, the reason given by the authority is shown on the document and the finance staff get a notification. The invoice can be corrected and sent again with one button.

It works the other way too. Once a day the system fetches the cost invoices issued to the venue from KSeF. If the supplier’s tax number and the total match exactly one kitchen order, the invoice links to it on its own. Costs go straight into the 13-week cash flow forecast.

One technical detail: KSeF 2.0 requires RSA-OAEP encryption with SHA-256, which the standard PHP library does not support. I implemented the encoding myself, following RFC 8017, and covered it with a test. No new dependency in the project.

Result

The venue owner never signs in to KSeF. Each invoice shows its state: sent, waiting, or rejected with a reason. Supplier invoices no longer have to be retyped into the system. KSeF is included in every subscription plan, and the manual mode (an XML file to upload) stays as a fallback.

Want a similar system in your company?

Let’s talk