einvoicing — EU e-invoicing for Ruby
Open source Ruby gem to generate Factur-X (PDF/A-3), CII D16B and UBL 2.1 invoices. Targets the French September 2026 B2B e-invoicing mandate and EN 16931.
What is einvoicing?
🏛️ The 2026 French mandate
From September 2026, all French B2B invoices must be transmitted electronically through a certified platform (PPF or PDP). Paper and non-structured PDFs will no longer be valid.
💎 A Ruby gem
einvoicing lets any Ruby or Rails application generate fully compliant invoices — without relying on third-party SaaS tools or manual processes.
📄 Factur-X PDF/A-3
Factur-X embeds a structured XML (CII D16B) inside a standard PDF. A human reads the PDF, a machine reads the XML. Both in one file. Validated by Mustang (PDF:valid XML:valid).
✅ Validated & tested
196 specs, 0 failures. PDF/A-3 conformance confirmed by Mustang CLI. Official XSD schemas bundled. GitHub CI runs Mustang on every push.
Current features
Invoice data model
Invoice, Party, LineItem, Tax — BigDecimal amounts, credit notes, payment means (IBAN, BIC)
CII D16B XML generator
EN 16931-compliant Cross Industry Invoice XML, Factur-X EN16931 profile
UBL 2.1 XML generator
Peppol BIS Billing 3.0 compliant, BuyerReference, PaymentMeans, TaxCurrencyCode
Factur-X PDF/A-3 embedding
Embeds CII XML into any PDF. Bundled sRGB ICC profile for PDF/A-3 OutputIntent conformance
French B2B validators
SIREN/SIRET Luhn checksum, TVA intracommunautaire format, IBAN ISO 13616, BIC format, VAT rates
Credit notes (avoir)
TypeCode 381, BillingReference to original invoice, required original_invoice_number validation
Payment means
IBAN, BIC, payment type code (SEPA credit transfer, etc.) in both CII and UBL
i18n error messages
Structured symbol error codes { field:, error:, message: } with English and French translations
Rails Invoiceable concern
Drop-in ActiveRecord concern, configurable validator, to_einvoice mapping
Chorus Pro / PPF client
OAuth2 (client_credentials), deposit_flux for Factur-X PDF upload, invoice status polling
GitHub CI with Mustang validation
Every push runs rspec + generates a sample invoice + validates it with Mustang CLI
Quick start
# Gemfile
gem "einvoicing"
# Build an invoice
invoice = Einvoicing::Invoice.new(
invoice_number: "FAC-2026-001",
issue_date: Date.today,
currency: "EUR",
seller: Einvoicing::Party.new(...),
buyer: Einvoicing::Party.new(...),
lines: [Einvoicing::LineItem.new(...)]
)
# Validate, generate XML, embed into PDF
errors = Einvoicing::Validators::FR.validate(invoice)
xml = Einvoicing::Formats::CII.generate(invoice)
pdf_out = Einvoicing::Formats::FacturX.embed(pdf_in, xml)
What's next
PPF B2B API (DGFiP)
The official French B2B e-invoicing portal API. Sandbox not available yet — DGFiP is building it. We'll integrate as soon as it opens (expected Q2/Q3 2026).
PDP integration (Pennylane, others)
Certified private platforms (PDPs) relay invoices to the PPF network. Waiting for sandbox access from Pennylane. Other PDPs will follow.
Peppol network transmission
Pan-European Peppol network support for UBL 2.1 invoices. UBL generation is already done — transmission layer coming.
Peppol BIS 3.0 Schematron validation
`Einvoicing::Validators::Peppol.validate_ubl(xml)` — requires Java + Saxon-HE 12. Bundled official Peppol BIS 3.0 XSLT.
SIRET lookup for buyers
Automatic SIRET lookup via INSEE Sirene API from SIREN, to fill the missing field on buyer parties.
Want to integrate this in your app?
Need help integrating Factur-X generation into your Ruby on Rails application? Get in touch.
Contact us