KSeF - National e-Invoice System
The free Polski for WooCommerce sends VAT invoices to KSeF 2.0 as FA(3) XML, checked against the official schema before sending. It authenticates with a KSeF certificate and private key, follows the status, stores the KSeF number and UPO, and prints the KSeF QR codes on the invoice. With a second certificate of type Offline it also issues invoices in offline mode. Test is the default environment.
KSeF is the National e-Invoice System run by the Polish Ministry of Finance. Sending runs in the background through Action Scheduler.
As of 28 November 2026 (Polski 1.59.0): FA(3) invoices go straight from your shop to the Ministry of Finance KSeF API, signed with your own certificate. No middleman service and no subscription: the module is part of the free plugin.
Since Polski 1.56.0 the whole KSeF engine lives in the free plugin. Polski PRO plugs into it: it adds invoice PDFs with the KSeF QR codes, corrections without a refund, the invoice list and REST routes. Since 1.57.0 the free Invoices module issues correction invoices for refunds itself.
What it does
Section titled "What it does"| Capability | Free Polski | With Polski PRO |
|---|---|---|
| FA(3) XML built from the invoice and validated against the official XSD before sending | Yes | Yes |
| Authentication with a KSeF certificate (XAdES signature) | Yes | Yes |
| Sending from the order screen, or every new invoice automatically | Yes | Yes |
| Status checks in the background, plus a manual refresh | Yes | Yes |
| KSeF number stored on the invoice, shown on the order screen and orders list | Yes | Yes |
| UPO receipt download (XML) | Yes | Yes |
| KOD I and KOD II QR codes on the invoice | On the invoice opened in the browser | Also on the PDF |
| Offline mode (offline24, announced unavailability or failure) | Yes, needs a KSeF certificate of type Offline | Yes |
| Technical correction of a rejected offline invoice | Yes | Yes |
| Connection test and checks in Tools > Site Health | Yes | Yes |
| Correction invoices (KOR) from WooCommerce refunds | Yes, since 1.57.0 | Yes |
| Corrections without a refund (VAT rate, buyer details, line names, date of supply, price or quantity) | No | Yes |
| REST routes for sending, status and UPO | No | Yes |
| Authentication with a KSeF token | Not supported, use a certificate | Not supported |
| Downloading the FA(3) XML from the order screen | Yes, since 1.59.0 | Yes |
| Sending many orders at once from the orders list | Yes, since 1.59.0 | Yes |
| Importing purchase invoices from KSeF | Not supported | Not supported |
Which invoices go to KSeF: without PRO, the VAT invoices of the free Invoices module. With Polski PRO active, the invoices PRO issues; the free module's invoices are then not sent automatically, so one sale cannot end up with two invoices in KSeF.
Requirements
Section titled "Requirements"- a KSeF certificate with its private key, requested and downloaded in the KSeF 2.0 Taxpayer Application (Aplikacja Podatnika KSeF 2.0). The Ministry's certificate module (MCU) issued certificates only until the end of January 2026 (Ministry of Finance: KSeF certificates)
- a valid ten-digit seller NIP. The store authenticates as this NIP, so it must be the NIP the certificate is authorised for. It comes from the company details in the Polski setup, or from the Polski PRO invoice settings when PRO holds one
- Action Scheduler, which ships with WooCommerce. Without it nothing can be queued
- the PHP openssl and sodium extensions, used to read the certificate, encrypt the invoice and protect the stored private key
Configuration
Section titled "Configuration"Go to Polski > Settings > KSeF. The screen needs the manage_woocommerce capability.
| Field | Description |
|---|---|
| Send invoices to KSeF | The master switch. While it is off, nothing is sent and the order screen says so. |
| Send each new invoice automatically | Queues every new invoice for KSeF as soon as it is issued, without a click. It does nothing until a certificate and key are stored. |
| Keep invoices to consumers outside KSeF | An invoice without a buyer tax ID is not sent automatically, also not in offline24. It can still be sent from the order screen. |
| Environment | Test sends to https://api-test.ksef.mf.gov.pl/v2, Production to https://api.ksef.mf.gov.pl/v2. The screen shows the address in use. Test is the default. |
| Seller NIP | Read only, with a link to the company details. When no valid NIP is set, the row says so and invoices cannot be sent. |
| Certificate and private key | Choose the files takes the certificate (.crt) and private key (.key) from Aplikacja Podatnika KSeF at once. The files are read in the browser and each is recognised by its content. Paste the text instead shows the PEM fields. After saving, the screen shows who the certificate is issued to and when it expires. |
| Private key passphrase | Read only together with a new private key. |
| Test the connection to KSeF | Logs in to KSeF with the stored certificate and reports the result. Nothing is sent. |
| Remove | Deletes the stored certificate and private key. |
The private key and its passphrase are encrypted with libsodium, under a key derived from the WordPress secure_auth salt. When SECURE_AUTH_KEY or SECURE_AUTH_SALT is missing from wp-config.php, WordPress keeps that salt in the database next to the encrypted key, and the screen warns about it. Define both constants with unique values, then load the key again. If the salts change later, the stored key can no longer be decrypted: the screen says so, and nothing is sent until you load the key again.
An admin notice warns 30 days before the login certificate expires. Once sending is on, Tools > Site Health checks the seller NIP, the certificate and whether the server reaches the KSeF API.
Switching between Test and Production does not resend anything. A job queued for one environment is not sent to the other: the invoice keeps an error asking you to send it again. An invoice accepted on Test can be sent again once the store is on Production.
Shops that used KSeF in Polski PRO before 2.0 keep their certificates, settings and queued invoices: the stored data did not move, only the code.
What KSeF requires, and when
Section titled "What KSeF requires, and when"KSeF duties come from the Polish VAT Act (Dz.U. 2026 poz. 1263, consolidated text). The provisions the plugin is built around:
| Provision | What it says | Where the plugin handles it |
|---|---|---|
| Art. 106ga(1) | Structured invoices are issued through KSeF. In force since 1 February 2026. | Sending from the order screen or automatically |
| Art. 106ga(2)(4) and (4) | The duty does not cover invoices to consumers, but they may still go through KSeF. | Keep invoices to consumers outside KSeF |
| Art. 145m | From 1 April to 31 December 2026, invoices outside KSeF are allowed while the gross sales on them stay at or below 10 000 zł a month. The right ends from the invoice that crosses the limit. | The 10 000 zł card of the KSeF readiness module |
| Art. 106nda(2) | An invoice issued offline is sent to KSeF by the next working day after its issue date. | Issuing mode offline24 |
| Art. 106nh(2) | Invoices issued while KSeF is unavailable are sent by the next working day after the unavailability ends. | Outage kind Unavailability |
| Art. 106nf(4) and (5) | Invoices issued during a KSeF failure are sent within 7 working days after the announced end of the failure; a new failure in that time moves the deadline. | Outage kind Failure |
Each row was read in the act's text on 28 November 2026. The full list is on Legal basis. This describes the law the plugin follows; it is not tax advice for your business.
What the FA(3) document carries
Section titled "What the FA(3) document carries"Besides the parties, lines and totals, the plugin fills these parts of FA(3) from data your shop already has:
| In the FA(3) XML | Where it comes from |
|---|---|
| Unit of measure per line (P_8A) | The product field Unit on the invoice, for example kg, m, l or usł. Empty means szt. Filter polski/invoice/unit. |
| VAT exemption, "zw" with its basis (P_19 with P_19A, or P_19B when the basis names the directive) | The product field VAT exemption basis, on a product sold with a 0% tax class |
| Cash accounting (P_16) | Cash accounting (metoda kasowa) in the VAT Display module |
| SKU (Indeks) and GTIN per line | The product SKU, and the WooCommerce GTIN field or else the Polski fallback GTIN. |
| Payment (Platnosc) | Paid and the payment date once the order is paid. The payment form for cash on delivery, Stripe, cheque and bank transfer; any other gateway goes as "other" with its title. With Polski PRO, an unpaid invoice also carries the due date and the bank account from the PRO invoice settings. Not on correction invoices. |
| Order number and order date (WarunkiTransakcji) | The WooCommerce order |
| Registers in the footer (Stopka) | The BDO number from the BDO number module. KRS and REGON only through the polski/ksef/registers filter. |
Download XML on the order screen shows the document exactly as it went to KSeF, or as it would go. Use it to check the data or to pass it to your accountant.
How an invoice gets to KSeF
Section titled "How an invoice gets to KSeF"- Issue a VAT invoice as usual.
- On the order screen, the KSeF box shows the invoice and a Send to KSeF button. With automatic sending on, the invoice is already queued.
- A background job builds the FA(3) document, checks it against the schema, authenticates with the certificate, opens an online session and sends the encrypted invoice.
- KSeF answers with a status. Accepted invoices get their KSeF number; rejected ones show the reason KSeF gave. An invoice still being processed is checked again every two minutes, up to 30 times.
- Once the invoice has its KSeF number, the plugin fetches the UPO, and the invoice shows the KSeF number and the KOD I QR code.
Only VAT invoices and correction invoices are sent. Proforma, receipt and packing slip documents are not KSeF documents and are refused. An invoice already in KSeF of the current environment cannot be sent again: a submitted invoice can only be corrected.
When KSeF cannot be reached or answers with an error, the job tries again, four attempts in total, with growing delays. When the last error looks like an outage (no answer, HTTP 408 or 5xx), the invoice stays queued and is sent again every hour for up to two days before it is marked as failed. When KSeF reports a rate limit, the job waits for the time KSeF asks for.
Offline mode
Section titled "Offline mode"An invoice can be issued in KSeF offline mode: it carries both QR codes from the moment it is issued, and the shop sends it to KSeF in the background before a deadline. Offline mode needs a second KSeF certificate, of type Offline. The login certificate cannot sign KOD II, and an Offline certificate cannot log in to KSeF.
Offline certificate
Section titled "Offline certificate"Under Polski > Settings > KSeF, section Offline mode:
| Field | Description |
|---|---|
| Offline certificate and key | The KSeF certificate of type Offline with its own .crt and .key files, loaded the same way as the login certificate. After saving, the screen shows its serial number and expiry date. The person or entity in it needs the InvoiceWrite permission for the shop NIP. |
| Offline key passphrase | Read only together with a new private key. |
| Remove | Deletes the stored Offline certificate and private key. |
An expired Offline certificate counts as none. An admin notice warns 30 days before it expires. Without a valid Offline certificate the offline switches below are greyed out.
When an invoice is issued offline
Section titled "When an invoice is issued offline"| Setting | Effect |
|---|---|
| Issuing mode: Online | The default. The invoice is sent online and gets its KSeF number first. |
| Issuing mode: offline24 | Every new invoice is issued offline and sent right away. The send deadline is the end of the next working day after the issue date. |
| KSeF outage announced by the Ministry | Switch it on only when the Ministry of Finance has announced KSeF unavailable or failing, and pick the kind: Unavailability (send by the next working day after it ends) or Failure (send within 7 working days after it ends). Enter the start and the end in Polish time; leave the end empty until it is announced. The shop never switches this on by itself. |
The deadlines follow the Ministry of Finance KSeF documentation (ksef-docs, offline modes). Working days are Monday to Friday without Polish public holidays, and a deadline ends at 23:59:59 Warsaw time. A failure announced while an offline24 or unavailability invoice is still waiting moves its deadline to 7 working days after that failure ends. Changing the outage end recomputes the deadlines of offline invoices not yet sent.
When KSeF stops answering several sends in a row and an Offline certificate is stored, an admin notice suggests the outage switch. It is a hint only: KSeF offers no way to check an announced outage.
What happens to an offline invoice
Section titled "What happens to an offline invoice"- On issue, the plugin builds the FA(3) XML once and stores it. KOD I is computed from that XML and KOD II is signed with the Offline key: KOD I is captioned OFFLINE and KOD II CERTYFIKAT.
- The invoice gets the KSeF status Offline and is queued at once, even when automatic sending is off.
- The stored XML is sent to KSeF byte for byte in offline mode. If the stored bytes no longer match the printed KOD I, the plugin refuses to send them. An offline invoice issued for Test is never sent to Production, or the other way round.
- When KSeF numbers the invoice, KOD I is captioned with the KSeF number instead of OFFLINE.
While KSeF does not answer, an offline invoice is sent again every hour until KSeF takes it, past the two-day limit of online invoices. After its deadline its status becomes Offline, overdue, and the plugin keeps sending it. Offline invoices due within a day or overdue are listed in an admin notice and in a daily mail to the site admin address.
Technical correction
Section titled "Technical correction"When KSeF rejects an offline invoice for a technical reason such as schema or size, the order's KSeF box shows Technical correction. It rebuilds the invoice with the same content and sends it again with a reference to the rejected file. The QR codes are recomputed, and KSeF links the old KOD I to the corrected invoice. A missing permission is not a technical reason: grant InvoiceWrite to the person or entity in the Offline certificate and send the invoice again. When the seller, buyer, lines or amounts have changed since the invoice was issued, a technical correction is refused, because it may not change the content. When KSeF answers 21166 (no technical correction allowed for this invoice), clarify it in the KSeF Taxpayer Application.
Correction invoices for refunds
Section titled "Correction invoices for refunds"Since 1.57.0 the free Invoices module issues a correction invoice when invoiced items are refunded in WooCommerce. It has its own series (KOR by default), the parties of the corrected invoice, the refunded lines as negative amounts, the reason, and the number and KSeF number of the corrected invoice. With KSeF sending on, it goes to KSeF after the invoice it corrects. A refund entered as an amount only gets a note on the order instead. With Polski PRO active, PRO issues the invoices and their corrections.
The order screen and the orders list
Section titled "The order screen and the orders list"The KSeF box on the order screen shows the KSeF status, the environment, the KSeF number (or the session reference while the invoice is processed) and the last error in words you can act on. Its buttons:
- Send to KSeF queues the invoice
- Refresh status asks KSeF now instead of waiting for the next check, and fetches the UPO if it is ready
- Download UPO saves the UPO receipt as an XML file named after the KSeF number
- Download XML saves the FA(3) document as sent, or as it would be sent
- Technical correction resends a rejected offline invoice (see above)
- Create correction issues a correction invoice for a refund that has none yet
With Polski PRO the box also offers Correct (a correction without a refund).
Once sending is on, the orders list has a KSeF column with the invoice's status as a badge: Not sent, Queued, Processing, Accepted, Offline, Offline, overdue, Rejected, Failed or No seller NIP. It works with both the legacy order storage and HPOS. While sending is on, the bulk action Send invoices to KSeF queues every invoice of the selected orders that KSeF has not taken yet, for example a backlog after an outage or after loading the certificate. While sending is off, the column shows the KSeF readiness flag described below.
KSeF readiness: flagging orders
Section titled "KSeF readiness: flagging orders"The KSeF readiness module (module ID ksef_ready, under Polski > Modules, off by default) marks which orders need a KSeF invoice. It never contacts KSeF itself.
| Setting | Default | Description |
|---|---|---|
| Orders that need a KSeF invoice | With a VAT ID (NIP) | Or: with a VAT ID, or when the customer asks for an invoice (the "I need a VAT invoice" box of the B2B checkout module); or every order, consumers included |
The NIP comes from the NIP module, which adds the field to the checkout and validates its checksum. When an order is created on the classic or the block checkout, the module:
- Reads the NIP from
_billing_nip, or from_polski_billing_nipwhen the first is empty - Decides whether the order needs a KSeF invoice, following the setting above
- Passes that decision through the
polski/ksef/is_requiredfilter - Saves the result to
_polski_ksef_required(yes/no) - Fires
polski/ksef/invoice_readywhen the answer is yes
Orders created before the module was switched on, or added by hand in the admin, are not checked. With sending off, the orders list shows a grey dash for orders that need no invoice, an orange dot for a flagged order and a green dot once _polski_ksef_status is sent or accepted.
The module also adds two cards to the Polski dashboard: gross orders with a VAT ID this month against 10 000 zł, and net consumer sales this year against 20 000 zł. Other currencies are converted at the NBP table A rate, fetched at most daily.
| Hook | Type | Arguments | When |
|---|---|---|---|
polski/ksef/is_required |
filter | bool $required, WC_Order $order |
Decides whether an order needs a KSeF invoice |
polski/ksef/invoice_ready |
action | WC_Order $order |
A flagged order was created |
polski/pro/ksef/submitted |
action | int $invoiceId, the KSeF answer |
The invoice was sent in an online session |
polski/pro/ksef/accepted |
action | int $invoiceId |
KSeF accepted the invoice |
polski/pro/ksef/rejected |
action | int $invoiceId, string $message |
KSeF rejected it, or all retries failed |
The polski/pro/ksef/* names are kept from the time the engine lived in Polski PRO, so existing code keeps working.
add_filter('polski/ksef/is_required', function (bool $required, WC_Order $order): bool { // Never flag orders below 100 PLN. if ($order->get_total() < 100) { return false; }
return $required;}, 10, 2);polski/ksef/invoice_ready runs while the checkout request is still in progress, before payment is confirmed. If you send invoices through your own accounting system instead of the built-in sending, queue the work there and do it later, for example on woocommerce_order_status_processing.
Troubleshooting
Section titled "Troubleshooting"Invoices are not sent Check that Send invoices to KSeF is on, that a valid seller NIP is set, and that a certificate and key are stored. Tools > Site Health names the missing piece.
The KSeF column does not display on the orders list Click "Screen Options" and tick the KSeF column.
The stored key can no longer be decrypted The WordPress security salts changed. Load the key and its passphrase again.
Does the free Polski plugin send invoices to KSeF?
Section titled "Does the free Polski plugin send invoices to KSeF?"Yes, since 1.56.0. Load a KSeF certificate and key under Polski > Settings > KSeF, switch sending on and start in the test environment.
Can I connect to KSeF with a token instead of a certificate?
Section titled "Can I connect to KSeF with a token instead of a certificate?"No. The plugin authenticates only with a KSeF certificate and its private key.
What happens when KSeF is down?
Section titled "What happens when KSeF is down?"The invoice stays queued. After four quick attempts, an outage keeps it in the queue with an hourly resend for up to two days. If the Ministry of Finance announces the outage, switch on KSeF outage announced by the Ministry: new invoices are then issued offline with KOD I and KOD II and sent before their deadline.
What does Polski PRO add to KSeF?
Section titled "What does Polski PRO add to KSeF?"Invoice PDFs with the KSeF QR codes, corrections without a refund (VAT rate, buyer details, line names, date of supply, price or quantity), the invoice list with a KSeF column and an Offline: to send filter, and REST routes. See KSeF in Polski PRO.
Next steps
Section titled "Next steps"- Report issues: GitHub Issues
- Discussions and questions: GitHub Discussions