Skip to main content

Generate ZUGFeRD/Factur-X e-invoices from webhook orders with PolyDoc and email

Workflow preview

Workflow preview
100%
Generate ZUGFeRD/Factur-X e-invoices from webhook orders with PolyDoc and email preview
Open on n8n.io

1. Workflow Overview

Quick Overview This workflow receives an order via webhook, builds an EN 16931 invoice payload and HTML, generates a ZUGFeRD/Factur X (PDF/A 3 + embedded XML) e invoice using PolyDoc, emails the PD...

Best for

  • Invoice Processing automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.if, n8n-nodes-base.code, n8n-nodes-polydoc.polydoc, n8n-nodes-base.emailsend, n8n-nodes-base.respondtowebhook, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by polydoc.tech.

Original n8n.io source

1.1 Workflow description

Title
Generate ZUGFeRD/Factur-X e-invoices from webhook orders with PolyDoc and email
Workflow name
Generate ZUGFeRD/Factur-X e-invoices from webhook orders with PolyDoc and email

Quick Overview

This workflow receives an order via webhook, builds an EN 16931 invoice payload and HTML, generates a ZUGFeRD/Factur-X (PDF/A-3 + embedded XML) e-invoice using PolyDoc, emails the PDF to the buyer, and returns the PDF in the webhook response.

How it works

  1. Receives an HTTP POST request with an order object via an n8n webhook endpoint.
  2. Validates that the order contains at least one line item and includes either a due date or payment terms.
  3. Calculates line totals, VAT, and invoice totals, and renders a printable HTML invoice along with a structured invoice payload.
  4. Uses PolyDoc to generate a verified ZUGFeRD/Factur-X EN 16931 e-invoice PDF/A-3 from the HTML and invoice data.
  5. Sends the generated PDF to the buyer via email using SMTP.
  6. Returns the generated PDF as the webhook response, or returns a 422 JSON error if the order is invalid.

Setup

  1. Create and add a PolyDoc API credential for the PolyDoc node.
  2. Configure an SMTP credential for the Email Send node (or remove the email step if you only want to return the PDF).
  3. Copy the webhook URL and configure your source system to POST JSON to /einvoice with the required order fields (seller, buyer, and lines, plus dueDate or paymentTerms).

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Receive order

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 2 - Valid order?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 3 - Build e-invoice

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - Generate ZUGFeRD PDF

Type / Role
n8n-nodes-polydoc.polyDoc - polyDoc
Config choices
Version 1

Block 5 - Email invoice to buyer

Type / Role
n8n-nodes-base.emailSend - emailSend
Config choices
Version 2.1

Block 6 - Return PDF

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

Block 7 - Reject (422)

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

Block 8 - How to use

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Generate ZUGFeRD/Factur-X e-invoices from webhook orders with PolyDoc and email
Complexity intermediate
Nodes 8
Categories Invoice Processing
Author polydoc.tech
Published 12 Jun 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/16321/16321.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Generate ZUGFeRD/Factur-X e-invoices from webhook orders with PolyDoc and email do?

Quick Overview This workflow receives an order via webhook, builds an EN 16931 invoice payload and HTML, generates a ZUGFeRD/Factur X (PDF/A 3 + embedded XML) e invoice using PolyDoc, emails the PD...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Invoice Processing use case.