Create
Turn the PDF your application renders into a Factur-X or ZUGFeRD invoice. Totals and the VAT breakdown are worked out with exact decimals, and an invalid invoice is refused before anything is written.
Open-source Go package · MIT license
Keep generating your invoice PDFs the way you do today. ZeRechnung adds the XML invoice and the metadata the standard requires, and the PDF becomes a compliant Factur-X or ZUGFeRD e-invoice. It also reads and validates the invoices you receive.
go get github.com/ritoon/zerechnung
Version 0: the API may still change before v1.
One package for the whole life of an e-invoice, on the sending side and on the receiving side.
Turn the PDF your application renders into a Factur-X or ZUGFeRD invoice. Totals and the VAT breakdown are worked out with exact decimals, and an invalid invoice is refused before anything is written.
Read hybrid PDFs and plain XML, in CII or UBL, from every ZUGFeRD version since 1.0. Data the model has no field for is kept, and written back in place.
Check the schemas, the EN 16931 rules, the profile rules and the national rules of France, Germany, the Netherlands and Italy, as well as Peppol. Each finding gives the official rule ID and the XPath of the element.
Convert between CII, UBL, FatturaPA and Facturae, and rewrite a PDF as PDF/A-3 when that needs no PDF engine. When it does, you get the reasons, page by page.
No CGO, no Java, no external binary, no network call. go get is all the setup there is.
Every pull request compares the results with KoSIT, Mustang and veraPDF, invoice by invoice. A new difference fails the build.
Reading and fully validating a typical invoice takes about 25 µs, five times less than with the next fastest Go package.
The XML is added with an incremental update. The original bytes are untouched, so an existing signature remains valid.
One invoice model, invoice.Invoice, for every syntax: converting from one to another is a parse and a marshal.
| Format | Countries | Read | Write | Validate |
|---|---|---|---|---|
| Factur-X 1.0x / ZUGFeRD 2.xCII · profiles MINIMUM to EXTENDED, and EXTENDED-CTC-FR | FRDE | yes | yes | yes |
| XRechnung 3.0CII · UBL | DE | yes | yes | yes |
| Peppol BIS Billing 3.0CII · UBL | EU | yes | yes | yes |
| NLCIUSCII · UBL | NL | yes | yes | yes |
| CIUS-ITCII · UBL | IT | yes | yes | yes |
| UBL 2.1Invoice · CreditNote · EN 16931 | EU | yes | yes | yes |
| FatturaPA 1.2FPA12 · FPR12 | IT | yes | yes | through CII (CIUS-IT) |
| Facturae 3.2.x3.2 · 3.2.1 · 3.2.2 | ES | yes | yes | XSD schema; EN 16931 through UBL or CII |
| ZUGFeRD 1.0CII | DE | yes | as Factur-X | minimal checks |
Every pull request runs the reference validators on the official test corpora and compares their results with those of ZeRechnung, invoice by invoice.
128 / 128
KoSIT
XRechnung invoices with exactly the same errors as the KoSIT validator.
241 / 282
Mustang
invoices with the same errors as Mustang. Each difference comes from the references themselves and is explained.
283 / 290
NPa
NLCIUS files with the same rules as the Dutch NPa validators. The other differences are justified.
609 / 614
veraPDF
invalid PDF/A files of the veraPDF corpus caught by a rule of the right clause.
Install the package. It needs Go 1.24 or later.
go get github.com/ritoon/zerechnungTurn your PDF into a Factur-X invoice.
pdf, err := zerechnung.Create(host, inv, &zerechnung.CreateOptions{
Calculate: true, // totals and VAT breakdown
Validate: &validate.Options{}, // refuse an invalid invoice
})Validate an invoice you received, with the national rules of the seller's country.
report, _, err := zerechnung.Check(pdf, &validate.Options{Auto: true})
if err != nil {
log.Fatal(err)
}
for _, f := range report.Errors() {
fmt.Println(f)
}Or use the command line. validate exits with code 1 on errors, so it fits in a CI pipeline as is.
go install github.com/ritoon/zerechnung/cmd/zerechnung@latest
zerechnung validate -auto invoice.pdfZeRechnung is free software under the MIT license. Bug reports, differences with a reference validator and missing rules are welcome.
Translations are open to everyone. Spotted a mistake in your language? Edit this translation