Create PDF invoices in Zapier
Zapier hands you an order or payment; this turns it into an invoice PDF in your own layout and numbering, then emails it or files it in Drive. One Custom Request step, plus a small Code step for line items.
- 1
Pick the Invoice starter
Set your company name, address, colors, and footer, then publish. Its fields are number, issued, due, company, customer, items, total, and an optional notes.
- 2
Turn line items into JSON
Zapier passes line items as comma-separated text. Add Code by Zapier (Run JavaScript) with input fields names, qtys, and prices mapped from the trigger's line items. If item names can contain commas, map each line item separately instead.
const names = inputData.names.split(","); const qtys = inputData.qtys.split(",").map(Number); const prices = inputData.prices.split(",").map(Number); const items = names.map((name, i) => ({ name: name.trim(), qty: qtys[i], price: prices[i], amount: qtys[i] * prices[i] })); return { items: JSON.stringify(items), total: items.reduce((sum, item) => sum + item.amount, 0) }; - 3
Add Webhooks by Zapier → Custom Request
Method POST to /v1/renders, headers Authorization (Bearer and your key), Content-Type application/json, and Idempotency-Key set to the order or payment id. Put this in Data, mapping the fields from your trigger and the Code step.
{"template": "tpl_...", "data": {"number": "{{order_id}}", "issued": "{{created_date}}", "due": "{{due_date}}", "company": {"name": "Your company", "address": "Your address"}, "customer": {"name": "{{customer_name}}", "email": "{{customer_email}}"}, "items": {{items}}, "total": {{total}}}} - 4
Email it
The response's url field is the PDF link. Add Gmail → Send Email and use it as an attachment (Gmail accepts a file URL) or put it in the message.