Factur-X: the electronic invoice
Since 1 September 2026, every business in France registered for VAT has to be able to receive an electronic invoice, and the large and mid-sized ones have to send theirs in that form. Smaller businesses follow on 1 September 2027. An invoice that is only a well-made page stops counting as an invoice, and not issuing one electronically is charged at 50 € an invoice, up to 15 000 € a year.
An electronic invoice is not a PDF sent by e-mail. It is the invoice written out as entries a machine reads, in one of the three forms the French reform accepts: two of them are XML files with no page at all, and the third is Factur-X, a PDF carrying that XML inside it. Factur-X is the only one of the three a person can still open and read, and it is the one most used in France.
This file is one. A person opens it and sees the page: the work, the tax at twenty per cent, five thousand one hundred euros to pay. Accounting software opens the same file, finds the invoice attached inside it, and reads those same amounts without anybody retyping them. The two cannot contradict each other, because there is only one document — and what it carries is printed further down this page, pulled back out of the very file offered here.
What goes inside is yours to choose. This library writes any of the five levels of detail the standard defines: Minimum, the few entries a document needs to be booked at all; Basic WL, the head of an invoice with no lines; Basic, the lines as well; EN 16931, everything the European standard asks for; and Extended, everything again including what only some trades use. It writes the file as PDF/A-3, which is the shape an invoice keeps to be filed away for years, attaches your XML under the name you give it, and states in the document itself that the attachment is the invoice and not a file riding along. The same invoice is written from Rust, from Python, or as the description a program of yours posts to our address.
And what goes inside must match what the document says about it. A file declaring an EN 16931 invoice and carrying a minimum one is not a file we write: the invoice is read back before the document goes out, and the document is refused rather than sent out contradicting itself. The same for an invoice attached under a name the document carries no file under, and for a file that is no invoice at all. What the invoice says inside is yours and is not judged here — but the two halves of the file can no longer say different things.
What this example shows
- One page: the work, the tax at twenty per cent, and five thousand one hundred euros to pay — and the same invoice inside the file, written as the XML that accounting software reads.
- The document saying what it carries: an invoice, Factur-X version 1.0, the Minimum level of detail, attached under factur-x.xml and carried as the document's own data — and any of the five levels of detail, from Minimum to Extended, written the same way.
- Handed to veraPDF, a free program with no hand in writing it, as a file fit for long-term keeping — and the invoice inside it pulled back out and compared with what went in.
The source code, complete
Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library.
The third is the description itself: a plain list of what the page has to say, which is what the service is sent.
Read the Rust source
Read the Python source
Read the JSON source
The document itself
Open the document in English
Open the document in French