> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omnilinker.pl/llms.txt
> Use this file to discover all available pages before exploring further.

# Issue invoices in Wapro

> Ask Wapro to issue the sale invoice for an order Omnilinker sent, by a button or automatically, and send the invoice as a PDF to the buyer by e-mail or to Allegro.

Omnilinker can ask Wapro to issue the sale invoice for an order it already sent to Wapro (see
[Orders to your ERP](https://docs.omnilinker.pl/erp/orders-to-erp.md)). Wapro issues the invoice, numbers it and issues the goods with it (a WZ).
Omnilinker then shows the invoice on the order card, makes a PDF of it and sends the PDF to the buyer.

> [!WARNING]
>
> Issuing invoices from Omnilinker is off until Omnilinker switches the feature **Issue invoices in the ERP** on for your
> organization (see [Features](https://docs.omnilinker.pl/administration/features.md)). Its live test with Wapro has not run yet. Until it is on, the
> **Invoice** block, the buttons and the invoice settings below do not appear, and you cannot switch it on yourself.

> [!WARNING]
>
> Omnilinker does **not** send invoices to KSeF. Wapro does, through its own KSeF sending (Businesslink), and you set that
> up in Wapro yourself. An invoice that Wapro issued but did not send to KSeF has not reached a company buyer the way the
> law now expects. Ask your accountant what applies to you.

## What Omnilinker does

* **Asks Wapro to issue the invoice** from the order Omnilinker sent. It does not build the invoice itself: the number,
  prices, VAT and the goods issue are Wapro's.
* **One invoice per order, for the whole order.** If a second request arrives, or someone already issued an invoice for
  the order in Wapro by hand, Omnilinker finds it and issues nothing.
* **Picks the document from the buyer.** You do not choose it.

  | Buyer | Document in Wapro |
  | - | - |
  | A company with a Polish tax id (NIP) | **VAT invoice** |
  | A company in another EU country, with an EU VAT id, delivered to another EU country, that the sales channel reports as an active VAT payer | **Intra-EU supply (WDT), 0% VAT** |
  | A company, delivered outside the EU | **Export, 0% VAT** |
  | A consumer, when the order source's settings say so | **VAT invoice** in the buyer's name |

  A company is a buyer who asked for an invoice and gave a tax id or a company name. A company with a name but no valid tax
  id waits as **a company without a valid tax id**. An EU company whose VAT status the channel did not report as active
  waits as **not supported yet: this kind of invoice**: check the VAT id in VIES and issue the invoice in Wapro. So does a
  consumer delivered outside the EU.
* **Issues it when you say**, for each order source: by hand, when the order is paid in full, or when it reaches a status
  you choose. A company's order is always invoiced at that moment; a consumer's depends on the source's consumer settings.
* **Makes the PDF itself** from the invoice data it reads from Wapro, in Polish, or in English for a buyer outside Poland,
  with the KSeF number and its QR code when Wapro has them.
* **Delivers the PDF** by e-mail, to the Allegro order, or both, as each order source says.

## What it does not do

* It does not send anything to KSeF or ask Wapro to. It only shows the KSeF number once Wapro reports one.
* It does not issue correcting invoices. Issue a correction in Wapro by hand.
* It does not issue an invoice **to a receipt**. Receipts are printed on Omnilinker's fiscal printers, not in Wapro. The
  choice is shown in the source's settings as **Coming later** and cannot be picked.
* It does not issue partial or advance invoices. The invoice covers the whole order.
* It works with Wapro only. Subiekt nexo is not available yet.

## Before you start

1. The order must be in Wapro: the order card's **ERP** section says **In Wapro**. An invoice asked for earlier waits
   until the order is there.
2. Wapro must be able to issue the document: the company needs the document type (VAT invoice, intra-EU supply or export)
   with automatic numbering, and the **ERP user for writes** needs the right to issue it.
3. The agent's SQL login needs the [rights for invoices](https://docs.omnilinker.pl/erp/requirements.md#rights-for-invoices).
4. If your company must use KSeF, set up Wapro's KSeF sending in Wapro (Businesslink).
5. To e-mail invoices, Customer service needs a verified e-mail sender (see
   [Send from your own domain](https://docs.omnilinker.pl/customer-service/sender-domains)). Until then the source's invoice settings say **E-mail
   is not set up: invoices are not sent by e-mail until Customer service has a verified e-mail sender.**
6. Sending invoices to buyers electronically needs their acceptance (article 106n of the Polish VAT Act). Shops usually
   ask for it in their terms of sale. Ask your accountant.

Without the SQL rights, only invoicing goes off: the connection's **PC and connector** tab shows **Issue invoices**
marked **switched off** (and **Read issued invoices**, which the PDF needs), an invoice waits with **the ERP connection is
not ready**, and orders, customers, prices and stock carry on.

The tray app's **Troubleshoot** shows **Wapro sends this company's invoices to KSeF** with **Yes** or **No**. It is
Wapro's own setting **Send to KSeF** for the company, and it decides when a company's PDF goes out (see
[When the PDF goes out](#when-the-pdf-goes-out)).

## Choose how each order source invoices

Open **Sales** > **Sales settings** > **Order sources**, or a connection's **Orders** tab under **ERP Integration** >
**Connected systems**. A source that sends to the ERP shows an **Invoices in Wapro** line with a summary; click
**Invoice settings**. You need **Manage sources** to change them; without it you can see them.

| Setting | Choices |
| - | - |
| **When to invoice** | **By hand (from the order or the order list)** (the default), **When the order is paid in full**, or **When the order reaches a status** and **Choose a status** |
| **Consumers who ask for an invoice** | **A VAT invoice instead of a receipt** (the default), or **An invoice to the receipt** (**Coming later**) |
| **Consumers who don't ask for one** | **No invoice** (the default), or **Invoice everyone (a VAT invoice in the buyer's name)** |
| **E-mail** | **Send the invoice to the buyer by e-mail** (off by default) |
| **Allegro** (Allegro sources only) | **Add the invoice to the Allegro order only when the buyer asked for one on Allegro** (the default), **Add every invoice to its Allegro order**, or **Never add invoices to Allegro orders** |

Companies are always invoiced at the moment you chose. A person or an automation rule can always issue an invoice by hand,
for a consumer who did not ask too. If the status you chose is deleted, the line says **On a status that no longer exists:
nothing is invoiced**.

> [!NOTE]
>
> An order that will be invoiced must not sit on Wapro's shared retail customer. Once a source is set to **Invoice
> everyone**, its consumer orders go to Wapro on a named customer (see [Customers in your ERP](https://docs.omnilinker.pl/erp/customers-in-erp.md)).
> An order already placed on the retail customer waits with **on the ERP's shared retail customer**: click **Cancel and
> send again** in the order's **ERP** section to place it again on a named customer.

## Issue an invoice

You need **Issue invoices in the ERP** (**Ordering**, under **Orders**) to see the order card's **Invoice** block and to
issue, retry or mark an invoice.

* **Automatically**, at the moment the source's settings say.
* **From the order**: in the **ERP** section's **Invoice** block, click **Issue invoice in Wapro**. A window shows the
  document, the buyer, the total and anything the invoice will wait for; click **Issue invoice in Wapro** to confirm.
* **In bulk**: tick orders on the **Orders** list and click **Issue invoices in Wapro**, up to 500 orders at a time. The
  preview shows how many orders will be invoiced, their total, how many of each document, the orders that will wait, and
  the orders it skips with the reason. On the list, the filter **Where the order stands in Wapro** has **Ready to
  invoice** and **Invoice failed**.
* **From an automation rule**: the step **Issue invoice in the ERP**. See [Automations](#automations).

An invoice cannot be undone from Omnilinker: a mistake is corrected in Wapro.

**A printed receipt.** If a fiscal receipt may already have been printed for the order, an invoice and the receipt would
count the sale twice. Issuing by hand asks you to tick **I checked: issue the invoice anyway**; the bulk preview counts
those orders and leaves them out unless you tick **I checked: invoice them too**. An automatic invoice for such an order
waits with **a receipt may have been printed** until a person confirms it on the order.

**Mark as issued by hand.** If you issued the invoice in Wapro yourself, click **Mark as issued by hand**. The order is
locked as an invoiced one, and Omnilinker only looks the invoice up in Wapro (to know when the goods left); it never issues
one. If it finds no finished invoice of the order (one still open in Wapro, say), or cannot look for one, the inbox tells
you: finish the invoice in Wapro and check that ERP Sync is running, then click **Look again in Wapro** in the order's
**Invoice** block. The button shows once the previous look has answered.

### What the Invoice block shows

| State | What it means |
| - | - |
| **Not invoiced in Wapro yet** | Nobody asked for the invoice. |
| **Waiting to be issued in Wapro** | Queued. A line under it says what it waits for, such as **The order is not in Wapro yet: the invoice is issued once it is.** |
| **Being issued in Wapro** | The agent is issuing it. The order's lines cannot change meanwhile. |
| **Invoiced in Wapro** | Issued, with its **Number**, **Document**, **Issued on** and **KSeF number**, or **Not in KSeF yet**. **Download PDF** and **Send to the buyer again** are here. |
| **Not confirmed: check Wapro** | No answer said whether Wapro issued it. Omnilinker looks for it in Wapro's order list; **Try again** never issues a second invoice. |
| **Wapro did not issue the invoice** | Wapro refused it, with the reason. Fix it, then click **Issue invoice in Wapro** again. |
| **Not issued in Wapro** | It failed, nothing was issued. Click **Try again**. |
| **Invoice request taken back** | Nothing was sent to Wapro. You can ask again. |

An invoice issued in Wapro without Omnilinker is shown as **Issued in Wapro outside Omnilinker**, and one you marked as
**Marked as issued in Wapro by hand**.

The request is dated when it is made: the issue and sale dates are that day in your organization's calendar, even if the
agent is offline for a while. A request the agent did not take within a day expires (**ERP Sync did not take the request
within a day. Nothing was issued.**), and a request that waited a week for something no person had to do is given up.
Omnilinker never sends either again by itself: click **Try again**.

If Wapro's answer is lost (the agent stopped at the wrong moment), the invoice shows **Not confirmed: check Wapro**, and
Omnilinker settles it from the next read of Wapro's orders. You never get a second invoice: every request carries a
marker that Wapro stores on the invoice (its external number), and a repeated request finds it.

## The invoice PDF and delivery

Omnilinker makes the PDF from the data Wapro holds. It says **Visualisation of the invoice issued in Wapro**: the legal
invoice is the one in Wapro. You need **View personal data** (**Ordering**, under **Orders**) to download it, because it
names the buyer.

* **E-mail.** With **Send the invoice to the buyer by e-mail** on, the buyer gets the **Your invoice** message with the PDF
  attached, in Polish for a buyer in Poland and in English otherwise, like the PDF. Its text is the **Your invoice** template
  under **Customer service** > **Templates** (see [Templates](https://docs.omnilinker.pl/customer-service/templates)), and it signs with your shop's
  name, so set that under **Shop details** first. The e-mail is in **Sent messages**.
* **Allegro.** The PDF is added to the Allegro order. An Allegro order's invoice is never e-mailed: Allegro does not allow
  invoices in messages, so adding it to the order is the only way. Allegro takes files up to 3 MB. If the Allegro order
  already has another invoice, Omnilinker does not replace it: the card says **not sent: Allegro already has invoice …**.
  When Allegro does not say whether the buyer asked for an invoice, the default choice does not upload it.
* **An invoice issued in Wapro without Omnilinker**, or one you marked as issued by hand, is never sent by itself. Click
  **Send to the buyer again** if you want it sent.
* **Send to the buyer again** sends the PDF once more, by the channels that apply to the order.

The block shows each channel as **E-mail to the buyer** or **Allegro**, with **waiting**, **sent**, **not sent** (and
why), **failed**, or **not for this order**.

### When the PDF goes out

* **A consumer's invoice** goes out as soon as Wapro issues it and the PDF is ready.
* **A company's invoice** goes out on issue only when your Wapro company does not send to KSeF. When it does, or while the
  agent has not yet said whether it does, the PDF waits for the KSeF number, so the buyer gets the invoice with it. The
  channel shows **waiting for the KSeF number**.
* After 3 days without a number, the inbox gets **Invoice … of order #… is not in KSeF yet**: check Wapro's KSeF sending.
  You can then send the PDF yourself with **Send to the buyer again**; Omnilinker asks you to confirm, and the PDF says
  **Not yet registered in KSeF**. The channel then shows **sent, marked "Not yet registered in KSeF"**.
* Once Wapro reports the KSeF number, Omnilinker makes the PDF again with the number and its QR code.

### How long PDFs are kept

The invoice data and the PDF name the buyer. Omnilinker keeps them for 90 days by default, deletes them when the order is
anonymized, and never writes them to its logs. To change how long, open **Sales** > **Sales settings** and choose
**Invoices** (`/settings/sales/invoices`): **Keep invoice PDFs for (days)** takes 30 to 3650 days. The section needs the
**Change how long invoice PDFs are kept** permission and shows only while invoicing from the ERP is switched on for your
organization. After that time, **Download PDF** on the order asks to read the invoice from Wapro again and makes a new PDF,
and **Send to the buyer again** does the same before it sends. Wapro keeps the invoice itself.

If a PDF could not be made (the inbox says **The PDF of invoice … could not be made**), click **Prepare again** in the
order's **Invoice** block: Omnilinker reads the invoice from Wapro once more.

## What happens after the invoice

* **The order can no longer be changed or deleted from Omnilinker.** Once the invoice is on its way or issued, changing the
  order's products and deleting it are refused: "Order #… is invoiced in Wapro, or its invoice is on its way. Its lines
  can't change and it can't be deleted here. Correct it in Wapro." **Cancel and send again** is gone too.
* **Cancelling the order.** An order cancelled in Omnilinker after its invoice cancels nothing in Wapro: the inbox says
  **Order #… cancelled after it was invoiced in Wapro**, and you correct the invoice there. While the invoice is being
  issued or is not confirmed, cancelling is refused ("Order #… can't be cancelled yet: its invoice is on its way to the
  ERP…"), and a cancellation from the sales channel is tried again every 15 minutes until the invoice is issued or has
  failed. If the agent is ever asked to cancel an invoiced order in Wapro, it refuses, and the card says Wapro refused the
  cancel because the order is invoiced or issued there.
* **Stock.** Issuing the invoice also issues the goods in Wapro (a WZ) and uses up the order's reservation. On a warehouse
  your ERP manages, Omnilinker releases its own hold of the order only after a stock read that began after the issue, so the
  stock is neither counted twice nor missing in between. See
  [Stock on a warehouse your ERP manages](https://docs.omnilinker.pl/erp/orders-to-erp.md#stock-on-a-warehouse-your-erp-manages).

## Automations

| | Name | What it does |
| - | - | - |
| Step | **Issue invoice in the ERP** | Asks the ERP for the order's invoice, as **Issue invoice** on the order card does. Only orders Omnilinker sent to the ERP; an invoice already issued or on its way is left as it is. A rule never confirms a printed receipt, and if a rule asked and the invoice failed, no rule asks again. |
| Trigger | **The ERP issues the invoice** | The ERP issued the order's invoice at Omnilinker's request, or the order already had one there. Field: **Invoice number**. |
| Trigger | **The invoice in the ERP fails** | The ERP refused to invoice the order, the request was given up, or the ERP did not confirm whether it issued the invoice. Not while the invoice only waits. Fields: **Invoice state** (`Failed`, `Declined` or `Unverified`) and **Invoice failure reason**. |

Both triggers also have **ERP connection**. See [Create and edit automations](https://docs.omnilinker.pl/automations/create-and-edit.md).

## Troubleshooting

A refusal from Wapro wrote nothing to Wapro. The inbox says why; fix it and click **Issue invoice in Wapro** again.

> [accordion] The order is cancelled or closed in Wapro
>
> A cancelled or closed order is not invoiced. Send the order again if it should be sold.

> [accordion] The order already has an invoice in Wapro
>
> Someone issued one by hand, or an earlier request did. Omnilinker issues nothing and shows that invoice as issued
> outside Omnilinker.

> [accordion] The order is partly realised in Wapro by another document
>
> Someone already issued part of the goods in Wapro. Omnilinker invoices a whole order only. Invoice it in Wapro.

> [accordion] A company without a valid tax id
>
> The buyer is a company, but its NIP fails the check or it has no tax id. Correct the invoice details on the order.

> [accordion] The customer is blocked, or lacks data, in Wapro
>
> Wapro refuses invoices to a blocked customer, an anonymized one or one over its credit limit, and to a customer that no
> longer exists. Correct the customer in Wapro, then ask for the invoice again.

> [accordion] Wapro numbers invoices by hand
>
> Omnilinker issues invoices only for a document type with automatic numbering, because with manual numbering Wapro would
> store the invoice without a number. Switch the type to automatic numbering in Wapro, or issue the invoice there.

> [accordion] Wapro cannot issue this kind of invoice from Omnilinker
>
> Wapro's company does not have the document type, or the **ERP user for writes** may not issue it (Wapro's right to issue
> the document type). An intra-EU supply also needs a buyer in another EU country who is a VAT payer with a VAT id in
> Wapro, and an export a buyer outside the EU. Add the type or the right, or issue the invoice in Wapro.

> [accordion] A line Wapro cannot invoice from Omnilinker
>
> A discounted line on an intra-EU supply or export invoice, or a VAT-exempt line whose product has no exemption text in
> Wapro. Issue the invoice in Wapro.

> [accordion] No exchange rate
>
> A foreign-currency order needs a rate in Wapro's table. Add the rate in Wapro, then ask for the invoice again.

> [accordion] The order was changed in Wapro
>
> Its VAT rates or its currency changed in Wapro since the order was sent, so the invoice would not match it. Nothing was
> issued. Check the order in Wapro.

> [accordion] Too little stock, or a price below cost
>
> Wapro has too little stock to issue the goods with the invoice, or refuses a price below the purchase cost.

> [accordion] Not issued in Wapro
>
> The agent or Wapro could not issue it, for example because Wapro's document licence limit is reached. Nothing was
> issued. The command on **ERP Integration** > **Commands** shows why. Fix it and click **Try again**.

> [accordion] The ERP connection is not ready
>
> The agent is offline or too old, or the SQL login lacks the rights for invoices, so the **PC and connector** tab shows
> **Issue invoices** switched off. See [Troubleshooting](https://docs.omnilinker.pl/erp/troubleshooting.md).

> [accordion] A change of the order did not reach Wapro
>
> The invoice would bill the old lines. Retry or undo the change in the order's **ERP** section first.

> [accordion] The PDF of invoice … could not be made
>
> Omnilinker could not read the invoice from Wapro or turn it into a PDF. The invoice itself is in Wapro. Check that the
> agent is running, then click **Prepare again** in the order's **Invoice** block.

> [card] [Orders to your ERP](https://docs.omnilinker.pl/erp/orders-to-erp.md)
>
> Send orders to Wapro first, and read back its invoices.

> [card] [Wapro](https://docs.omnilinker.pl/erp/providers/wapro.md)
>
> What the connector writes, and the SQL rights it needs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.