UBL E-Invoice Generator
Operator: Abdulla Al Fahad. How tools are built and checked
Several countries now expect invoices to arrive as structured data, and a PDF does not qualify. If your customer is a public body, a large buyer on the Peppol network, or a company in a country with an e-invoicing mandate, you need an XML file that a receiving system can read without anyone retyping it.
This tool builds that file. You enter the seller, buyer, payment details and invoice lines, and it writes a UBL 2.1 Invoice in the Peppol BIS Billing 3.0 customization, or plain EN 16931 if you pick that profile. The Invoice Generator elsewhere on this site makes a printable PDF only; this one produces the machine-readable document and a PDF copy of the same numbers.
Key features
- Peppol BIS Billing 3.0 or EN 16931 core customization
- Form entry, or CSV and XLSX lines matched by header name
- VAT breakdown grouped by category and rate with exemption reasons
- Live check of required fields, VAT category rules, IBAN check digits and due-date logic, tagged with the rule IDs
- Readable A4 PDF built from the same figures as the XML
- Seller, bank account and profile remembered in this browser
Which fields are written, VAT categories and the rules checked
The XML is a UBL 2.1 Invoice with type code 380. With the Peppol profile the CustomizationID is urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 and the ProfileID is urn:fdc:peppol.eu:2017:poacc:billing:01:1.0; with the EN 16931 profile only the core customization string is written. Elements follow the order the UBL schema demands, which matters because a receiver that validates against the schema rejects a file whose children are shuffled.
Seller and buyer carry name, postal address with a two-letter country code, VAT ID, an electronic address with its scheme (email, GLN, DUNS, Dutch KvK or OIN, Norwegian organisation number, German Leitweg-ID, Belgian enterprise or VAT number, German VAT number), an optional registration number and a contact. Payment means is written with the account ID, optional holder name and BIC, payment reference and payment terms text.
Each line has an item name, optional description and SKU, quantity with a UN/ECE unit code, a unit price, a VAT category and a rate. The line amount is quantity times price rounded to cents, half away from zero. Lines are grouped by category and rate; each group's taxable amount is the sum of its line amounts and its VAT is that sum times the rate, rounded once per group, which is how EN 16931 expects the breakdown to be computed.
Payment means is written with the account ID, optional holder name and BIC, payment reference and payment terms text. When the amount due is above zero the invoice needs a due date or payment terms (rule BR-CO-25), and a due date earlier than the issue date is flagged. A credit transfer needs an account number (BR-61); one that fails the mod-97 IBAN check digits is warned about but not blocked, since UBL also carries non-IBAN account formats.
Not covered: credit notes, document-level allowances or charges, invoicing periods, delivery details, attachments, a separate payee, and the extra fields XRechnung requires beyond Peppol. A run is limited to 500 lines. The supported VAT categories and what each one demands are listed in the section below.
How it works
Totals are recomputed from the lines on every keystroke by the same code that writes the XML, so what you see in the Totals panel is what the file contains. The XML is built as text with every value escaped and control characters removed, and it is only offered for download when no blocking problem remains.
Typical uses
- Invoicing a municipality from a one-person consultancy: 12 hours at 95 plus a 240 hosting fee, with the buyer's Leitweg-ID as the buyer reference
- Converting a 30-line monthly retainer spreadsheet into UBL by dropping the CSV in, instead of keying the lines into an ERP
- Producing a test file to try a new Peppol access point before real invoices go through
Building one
- Choose the profile, enter the invoice number, issue date and currency.
- Fill in seller and buyer. Peppol needs an electronic address for both.
- Enter the payment account, due date or payment terms, and your buyer reference.
- Add the lines by hand, or drop a CSV with columns such as item, quantity, unit_price and vat_rate.
- Give a reason text for any exempt, reverse-charge or export category.
- Clear the problems in the Checks panel, then download the XML and the PDF.
Example
Lines CSV with two VAT rates
item,quantity,unit_price,vat_rate
Web design - site relaunch,12,95,19
Managed hosting 12 months,1,240,19
Printed style guide,2,24.50,7Totals in the XML
Line total 1429.00
VAT S 19%: taxable 1380.00, tax 262.20
VAT S 7%: taxable 49.00, tax 3.43
Total with VAT 1694.63Things to check before you rely on it
The checks cover common business rules, not the whole EN 16931 and Peppol rule sets. Validate with your access point before relying on a file.
The tool cannot send the file. Delivery needs a Peppol access point or your customer's portal.
Rounding is per VAT group, not per line, so a customer who recomputes tax line by line can see a one-cent difference.
- Use scheme EM and an email address as the endpoint only if the buyer's access point is registered under that email; many are registered by GLN or national ID instead.
- Put the customer's PO number in the buyer reference; it is the field most receiving systems route on.
Common errors and how to fix them
- PEPPOL-EN16931-R003
- Peppol requires a buyer reference or a purchase order reference. Ask the customer which one they expect, or switch to the EN 16931 profile if you are not sending through Peppol.
- BR-E-10 (and the same rule for AE, K, G, O)
- An exempt or special category needs a reason text. Type the legal reason into the field that appears under the lines.
- BR-CO-25
- The amount due is above zero, so the invoice needs a due date or payment terms.
- "fails the IBAN check digits"
- A digit in the account number is likely mistyped. The tool still lets you export, since UBL also allows non-IBAN account numbers.
Which VAT category to use
Each invoice line carries one of seven EN 16931 categories. The checks tied to each are listed with their rule IDs so a rejection from your access point can be matched to a line here.
- S, standard rate: needs the seller's VAT ID and a rate above 0 (BR-S-02, BR-S-05).
- Z, zero rated: rate 0, no reason text needed.
- E, exempt from VAT: rate 0 and an exemption reason (BR-E-10).
- AE, reverse charge: the seller's VAT ID, plus the buyer's VAT ID or the buyer's legal registration ID (BR-AE-02), and a reason text.
- K, intra-community supply: the seller's and the buyer's VAT IDs (BR-IC-02), and a reason text.
- G, export outside the EU: the seller's VAT ID and a reason text (BR-G-02).
- O, not subject to VAT: no VAT ID on either party (BR-O-02), no other category on the same invoice (BR-O-11), and no percentage on the line (BR-O-05).
Frequently asked questions
Is this XRechnung?
No. XRechnung is a German specification built on EN 16931 that adds its own mandatory fields (such as a Leitweg-ID as buyer reference and seller contact details). The Peppol and EN 16931 files here may need those additions for German public-sector recipients.
Can I make a credit note?
Not yet. Only invoices with type code 380 are written; a credit note is a different UBL document type.
Does the XML include the PDF?
No. The PDF is a separate download for people and the XML is the one systems read. Which of the two counts as the legal original depends on your country and your customer's agreement, so confirm that with your tax adviser or access point.