## TL;DR

ZUGFeRD embeds Factur-X XML inside the PDF, so the pipeline is: pull the finalized Stripe invoice (lines, taxes, totals, seller and buyer tax IDs), map it to the Factur-X schema at the right profile (BASIC or EN 16931), and generate a PDF/A-3 with the XML attached. Validate the output against a Factur-X validator before sending. Stripe does not generate this natively; it is a post-processing step on invoice.finalized.

## Steps

1. On invoice.finalized, fetch the invoice with expanded lines, tax details, and both parties tax IDs.
   Expected output: All source data for the XML is in hand.
2. Map Stripe fields to Factur-X: line items, tax categories and rates, totals, seller and buyer ids.
   Expected output: The mapping is explicit per field.
3. Choose the profile: BASIC for simple invoices, EN 16931 for full compliance.
   Expected output: The profile matches what the recipient's system expects.
4. Generate a PDF/A-3 with the XML embedded using a ZUGFeRD library.
   Expected output: The output is a compliant hybrid invoice.
5. Validate with a Factur-X validator and fix mapping errors before first production send.
   Expected output: Invalid XML never reaches customers.

## When to use

- EU customers require ZUGFeRD/Factur-X e-invoices
- German or French B2B invoicing compliance is needed
- You post-process Stripe invoices into e-invoice formats

## When not to use

- The customer only needs Peppol (different network and format)
- You need Stripe-native e-invoicing (not offered; post-processing is the path)
- Invoices are B2C (e-invoicing mandates target B2B)

## Compatibility

Stripe Invoices API; Factur-X/ZUGFeRD libraries (per language); PDF/A-3 generation. Trigger on invoice.finalized webhook.

## Variant phrasings

### ### ZUGFeRD from Stripe invoice

### ### Factur-X XML Stripe billing

### ### e-invoice EU Stripe post-processing

## Root cause

EU e-invoicing mandates require structured data, not just a readable PDF, and Stripe's invoice model predates those mandates, so the compliant artifact is built downstream. ZUGFeRD's hybrid design (human PDF plus machine XML in one file) makes it the pragmatic target: one file satisfies both the auditor and the AP robot.

## Edge cases

- Tax ID mapping is the top source of validation failures; get seller and buyer IDs right
- Credit notes need the same treatment as invoices under most mandates
- Deadlines phase in by company size and country; check the current mandate calendar

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_nV9QOeKBQ-EXUcqYikQIYQ
