Duplicate KSeF invoices from order status changes
In short: a duplicate invoice in KSeF (Krajowy System e-Faktur, the Polish National e-Invoicing System) usually appears when a plugin or order manager issues an invoice every time an order enters a given status, and someone moves the status back and sets it again. KSeF only rejects an invoice with the same number, so two invoices with different numbers both go through. Invoices cannot be deleted from KSeF: you issue a correction to zero for one of them. You prevent it with a single trigger, a "does this order already have an invoice?" check and one tool that sends to KSeF.
Where two invoices for one order come from
Automatic invoicing in stores follows a simple rule: "when the order enters status X, issue an invoice". Trouble starts when the status changes more than once:
- WooCommerce fires the
woocommerce_order_status_{status}action for the target status on every status change (theWC_Orderclass). An order marked "Completed", moved back to "Processing" and marked "Completed" again fires that action twice. A plugin that does not check whether an invoice already exists will issue a second one. - PrestaShop itself assigns an invoice number only once: when the order enters a status with the invoice option and has no number yet (
OrderHistory::changeIdOrderState). Modules that react to every status change (theactionOrderStatusPostUpdatehook) can still send a document again if they do not guard against it. - Order managers (Base, Apilo) build automation from an event, conditions and an action. The event is often a status change. A rule without a condition that excludes already invoiced orders issues another invoice every time an order returns to that status. Invoicing software that issues an invoice when an Allegro order reaches a given status works the same way; a table of tools for sellers is in KSeF and Allegro.
- Two tools at once. The store issues an invoice through a plugin and the order manager issues its own. Each has its own numbering, so KSeF accepts both.
This is not theory. In October 2026, the owner of an integration agency described on LinkedIn a case where one status change back and forth in a multichannel store produced two KSeF invoices. The builders of another order manager described a bug in which a status change triggered a plugin that issued 28 unnecessary invoices; they managed to stop them before they reached KSeF.
Why KSeF does not stop the duplicate
KSeF checks for duplicates narrowly. It rejects an invoice with error code 440 ("Duplikat faktury", duplicate invoice) when the seller's NIP (Polish tax ID), the invoice type and the invoice number all match (KSeF 2.0 API documentation, invoice verification). A second invoice for the same order usually has the next number in the series, so for KSeF it is a completely new invoice.
An accepted invoice cannot be deleted or edited. The Ministry of Finance says plainly that once accepted by KSeF, an invoice becomes a legal document that cannot be changed, and errors are fixed with a correction invoice (MF FAQ, category "Wystawianie i otrzymywanie faktur", question 18). The KSeF 2.0 API has no delete operation either. The buyer sees both invoices in KSeF as soon as the KSeF numbers are assigned, because that is when an invoice counts as received (Article 106na(3) of the Polish VAT Act).
How to fix a duplicate that is already in KSeF
- Decide which invoice stays. Usually the first one, because its KSeF number may already have reached the customer, the accountant or a transfer title.
- Check that both cover the same sale. Compare the order number, amounts and the buyer's NIP. If the second invoice has a different NIP, that is a different problem (wrong buyer).
- Issue a correction to zero for the second invoice. The correction quotes the KSeF number of the corrected invoice (Article 106j(2)(2a)) and zeroes all lines. The legal ground is an error (Article 106j(1)(5)). As the reason, write for example "Invoice issued in error, duplicate of invoice no. ...". General rules: KSeF corrections and refunds.
- Tell the buyer. Write which invoice is the right one, so the customer does not pay twice or deduct VAT from both. In KSeF the tax office sees the whole chain of documents, so both sides should book it the same way.
- Agree the correction period with your accountant. This is the correction of an error, not a discount or a return, so confirm when it goes into the JPK (Polish VAT return file).
- Remove the cause before the order changes status again. Otherwise a third invoice is only a matter of time.
The number of corrections is not limited (MF FAQ, same category, question 22), so 28 duplicates mean 28 corrections. With many of them, issue them programmatically from a list of KSeF numbers to correct, and review that list with your accountant before sending.
If KSeF rejected the file, there is no invoice and nothing to correct (MF FAQ, question 20). If an invoice is still "processing", do not send it again by hand; wait for the result.
How to prevent it: rules for every store
- One trigger. The invoice is created at one moment, ideally after payment, not on several statuses.
- A check before sending. Before the system sends an invoice, it checks whether the order already has one. Developers call this idempotency: the same order number always yields the same single invoice.
- One tool sends to KSeF. In the other one, turn off automatic invoices or exclude that sales channel.
- A separate number series in each tool that issues anything. Then the number alone tells you where an invoice came from.
- A volume fuse. If an unusually large number of invoices appears within minutes, sending stops until someone checks.
- A daily comparison. The list of sales invoices in the taxpayer app against yesterday's orders with a NIP. Two invoices with the same order number stand out at once.
Checklist per platform
| Platform or tool | What to check |
|---|---|
| WooCommerce | on which status the plugin issues the invoice; whether re-entering that status issues another; whether the order stores the invoice number and KSeF number |
| PrestaShop | which status has the invoice option ticked; whether the KSeF module sends the PrestaShop invoice (with its number) or issues its own; whether it reacts to every status change |
| Base (BaseLinker) | automatic actions that issue invoices: event, conditions, rule order; whether a store plugin also issues invoices; do not resend "processing" invoices by hand |
| Apilo | automatic tasks with the "issue sales document" action; add the condition "Czy zamówienie ma wystawioną fakturę?" (does the order already have an invoice?); one number series per channel |
| Your own integration or API | an idempotency key on every call; invoice uniqueness per order number; retries only with the same key |
Platform details: KSeF for WooCommerce, KSeF for PrestaShop and BaseLinker and KSeF.
How it works with us
In KSeF Faktury, one order yields one invoice, and repeated sends of the same order are recognised. Our API states the rule explicitly: an invoice is unique per order identifier, so a second call returns the existing invoice instead of issuing a new one, and the Idempotency-Key header makes retries after a network error safe. Technical description: idempotency in the API.
Frequently asked questions
Can I delete a duplicate invoice from KSeF?
No. An invoice accepted by KSeF cannot be deleted or edited. You correct the unnecessary one to zero.
Shouldn't KSeF detect that it is the same sale?
KSeF compares only the seller's NIP, the invoice type and the invoice number. It does not know your store's order number, so it treats two invoices with different numbers as two different sales.
Which invoice should stay, the first or the second?
Usually the first, because its number may already be with the customer or in a payment. What matters is keeping the one the customer knows and telling them clearly.
Does a duplicate consumer invoice also need a correction?
If an invoice for a private person was sent to KSeF, it is an accepted invoice and you correct it too. You do not have to send consumer invoices to KSeF at all, though: KSeF invoice for consumers.
This article is general information and is not tax advice.
Sources
- Pytania i odpowiedzi KSeF 2.0 (ksef.podatki.gov.pl) (MF FAQ): category "Wystawianie i otrzymywanie faktur", questions 18, 20, 22
- KSeF 2.0 API documentation, invoice verification, code 440 (MF, GitHub)
- Polish VAT Act, consolidated text Dz.U. 2026 poz. 1263 (eli.gov.pl): Articles 106j and 106na
- WooCommerce: order statuses (woocommerce.com) and WC_Order class source (GitHub)
- PrestaShop 8: OrderHistory class source (GitHub)
- Base: order handling automation (base.com)
- Apilo: automatic tasks, list of conditions (apilo.com)
Status as of 26 October 2026.