# E-invoices - Folioline 1.x documentation

> The Factur-X / ZUGFeRD e-invoice inside every PDF, XRechnung and Peppol BIS files, what each format needs, and what Folioline doesn't do.

An e-invoice is an invoice as structured data, which your customer's accounting software can read without typing it in. Folioline makes e-invoice files from the same frozen invoice as the PDF, so both always say the same.

> [!NOTE]
> Folioline makes the files; it doesn't send them. It doesn't connect to Peppol, a government portal or any other e-invoicing network. Your customer or accountant uploads or archives the files, or you pass them to a service that sends them. Whether a format meets a rule in your country is for your accountant or tax office to say.

## The formats

| Format | What it is |
|---|---|
| **ZUGFeRD / Factur-X (EN 16931)** | A PDF with the invoice data inside it, used in Germany and France and readable by most European accounting software. Every Folioline PDF carries it, so a normal invoice PDF is already an e-invoice. |
| **XRechnung (CII)** and **XRechnung (UBL)** | The format German public-sector buyers require, in its two syntaxes. Ask your customer which one they want. |
| **Peppol BIS Billing 3.0** | The format used on the Peppol network, between businesses. |

Every PDF is a PDF/A-3 file, the archive format, with the Factur-X data attached as `factur-x.xml`.

## Getting the files

- **In emails**: choose a format under **WooCommerce → Folioline → Documents → E-invoice file**. Its file then goes with the invoice and credit note PDFs in every email they're attached to.
- **In My Account**: the same format is offered next to the PDF, as "XRechnung (UBL) XML" for example.
- **On the order screen**: the **Documents** box links each document's **PDF** and **XML**. The XML is the format chosen for emails; with no format chosen, or with Factur-X / ZUGFeRD (whose data is inside the PDF), it's XRechnung (CII).
- **In bulk**: on **WooCommerce → Invoices**, choose a format, or **PDF and** a format, then **Download as ZIP** (see [Invoices and numbering](invoices-and-numbering)).

## What each format needs

E-invoices are checked strictly by the software that reads them, so Folioline only writes a file when the invoice has what the format needs. Most of it comes from the **Seller** tab under **WooCommerce → Folioline** and your store address.

| Every format | |
|---|---|
| Your store address's country, and the customer's billing country | **WooCommerce → Settings → General**, and the order. |
| The customer's name or company | The order's billing address. |
| Your **VAT ID** or **Tax number** | **Seller** tab. Exports and intra-EU deliveries of goods need the VAT ID. |
| The customer's VAT number | For reverse charge and intra-EU deliveries; it's on the order when VAT came off. |
| Your **Commercial register** or **Tax number** | For sales outside the scope of EU VAT, such as services to customers outside the EU. |

| XRechnung | |
|---|---|
| Your **Phone** and **Email** | **Seller** tab. |
| Your store's city and postcode, and the customer's | Store address and billing address. |
| The customer's email address | The order. |

| Peppol BIS | |
|---|---|
| A Peppol ID for you and the customer | Worked out from your VAT ID and the customer's VAT number. Peppol is for business customers: an order without a VAT number can't be a Peppol file. |

When something is missing, the download, the email or the ZIP's `errors.txt` says what, such as "XRechnung needs the seller's phone number and email address." The PDF is still made, without the Factur-X data if the invoice can't hold it.

> [!NOTE]
> Invoices keep the seller details they were issued with. Adding your phone number later helps the invoices issued from then on, not the ones you already have. Fill in the **Seller** tab before you sell to customers who need e-invoices.

## Buyer reference and Leitweg-ID

A German public buyer gives you a Leitweg-ID, and XRechnung invoices to them must carry it as the buyer reference. Other customers may ask for their own reference, such as a purchase order number.

1. Open the order under **WooCommerce → Orders**.
2. In the **VAT** box, type it in **Buyer reference**, for example `04011000-12345-34`.
3. Click **Update**.

The order gets the note "Buyer reference set to 04011000-12345-34." The next time the invoice is downloaded or emailed, Folioline makes new e-invoice files, and a new PDF with its Factur-X data, with the reference, so you can add it after the invoice is issued. The files made before are kept as they were. Credit notes for the order carry the same reference. Leave the field empty for the order number.

Add the reference before you send the invoice: a file the customer already has keeps the reference it was made with. The reference is kept on the order, so if you delete the order, files made from then on use the order number.

## Things Folioline fills in for you

- **Buyer reference**: the order number, unless you type one on the order (below).
- **Payment**: for unpaid invoices with an IBAN, a SEPA bank transfer to your account, with the invoice number as the reference; otherwise how the order was paid.
- **VAT**: each line's VAT category, and the reason for 0% VAT (reverse charge, intra-EU delivery, export, outside the scope).

Source: https://extendiment.com/plugins/folioline/docs/1.x/e-invoices
