Generate branded invoice PDFs from webhook orders with PolyDoc and email

Quick overview This workflow receives an order via webhook, validates required fields, calculates invoice totals, renders a branded invoice PDF using a saved PolyDoc template, emails the PDF to the customer, and returns the same PDF in the webhook response.

How it works Receives an order payload in a POST request via an n8n webhook. Validates that the order includes at least one line item and a customer email, and returns a 422 JSON error if the payload is incomplete. Calculates line totals, subtotal, tax amount, and grand total, and formats the invoice data (invoice number, dates, currency, and customer details). Uses PolyDoc to populate a saved template with the invoice data and render an A4 PDF. Sends the generated PDF to the customer by email as an attachment. Returns the generated PDF as the webhook response for immediate download.

Setup Create a PolyDoc API credential in n8n and replace YOUR_TEMPLATE_ID with your saved invoice template ID from the PolyDoc dashboard. Configure an SMTP credential (or replace the email step with another provider) and set the sender address (for example, update billing@example.com). Copy the webhook URL from the webhook trigger and configure your store/checkout/CRM to POST orders to it using the expected order structure (including order.lines and order.customer.email).

0
Downloads
0
Views
7.53
Quality Score
beginner
Complexity
Author:polydoc.tech(View Original →)
Created:7/19/2026
Updated:7/20/2026

🔒 Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments