Create a PDF invoice for every Shopify order

Create a PDF invoice for every Shopify order

Shopify order PDF invoices, created automatically for every paid order with Zapier or a webhook, then emailed to the customer or saved to Google Drive.

Quick answer. When a Shopify order is paid, Zapier picks up the order details and drops them into an invoice template. html-pdf.com turns that template into a PDF, and the next step emails it to the customer or saves it to a folder. You set it up once and every new order gets its own invoice.

What you'll build

Each time someone pays in your store, a branded A4 invoice appears a few seconds later. It shows your logo, the order number, the customer's name and address, every product with its price, shipping, tax and the total.

The customer gets it by email as a normal PDF attachment. You can also keep a copy in Google Drive or Dropbox, so your accountant has every invoice in one place. The same setup works for packing slips if you swap the template.

What you need

Step by step with Zapier

This path needs no code. It takes about 15 minutes.

  1. Trigger. Create a Zap. Choose Shopify as the app and New Paid Order as the event. Connect your store and pull in a test order.
  2. Make the PDF. Add an action, Webhooks by Zapier → Custom Request. Set Method to POST and URL to https://html-pdf.com/v1/pdf.
  3. Add your key. Under Headers, add Authorization with the value Bearer hp_live_... and Content-Type with application/json.
  4. Paste the template. In Data, paste the JSON below. Replace the sample text with Shopify fields from the dropdown, like the order number and customer name.
  5. Send it. Add Gmail → Send Email. Put the customer's email in To and map the url from step 2 into Attachments. Zapier downloads the PDF from that link.
{
  "html": "<h1>Invoice #1042</h1><p>Billed to Jane Doe</p><p>Total: 59.00 USD</p>",
  "format": "A4",
  "margin": "15mm",
  "filename": "invoice-1042.pdf",
  "response": "url"
}

The "response": "url" part asks for a download link instead of a raw file. Links last 24 hours, which is plenty for the email step. Want to keep the PDF longer? Add Google Drive → Upload File and map the same url.

Line items. Zapier lists products as comma separated values. For a clean table with one row per product, add a Code by Zapier step that builds the rows, or use our Zapier guide for more patterns.

Prefer Make or n8n? In n8n, use the Shopify Trigger node with the order paid topic, then an HTTP Request node. See the n8n guide and Make guide.

Shopify Flow. Flow has a Send HTTP request action you can attach to the Order paid trigger. It is not available on the Basic plan, and attaching the PDF to an email still needs another tool, so Zapier is the simpler start.

Code path for developers

If you run your own server, subscribe to the orders/paid webhook in Shopify and render the invoice when it arrives.

app.post("/webhooks/orders-paid", express.json(), async (req, res) => {
  const order = req.body;
  const rows = order.line_items
    .map(i => `<tr><td>${i.title}</td><td>${i.quantity}</td><td>${i.price}</td></tr>`)
    .join("");
  const html = `<h1>Invoice ${order.name}</h1><table>${rows}</table><p>Total ${order.total_price} ${order.currency}</p>`;

  const pdf = await fetch("https://html-pdf.com/v1/pdf", {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.HTML_PDF_KEY}`, "Content-Type": "application/json" },
    body: JSON.stringify({ html, filename: `invoice-${order.order_number}.pdf` }),
  });
  // pdf body is the PDF file. Email it or upload it to storage.
  res.sendStatus(200);
});

Verify the X-Shopify-Hmac-Sha256 header before trusting the payload. More detail is on the invoice PDF page.

Ask your AI agent

Connect the html-pdf.com MCP server to Claude or ChatGPT and you can design the invoice by chatting. Try this prompt.

Using html-pdf, make an A4 invoice PDF for my shop "Northwind Candles". Order #1042, customer Jane Doe, 2 Lavender candles at 18 USD, 1 Gift box at 12 USD, shipping 5 USD. Put my logo text top left and a thank you note at the bottom.

Once you like the design, ask the agent for the HTML and paste it into your Zapier step.

Cost

Each PDF page uses one credit, and a one page invoice is one credit. After the free 100, packs start at $10 for 1,000 pages and purchased credits never expire. Failed renders cost nothing. See pricing.

FAQ

Does Shopify create PDF invoices on its own?

Shopify can print order pages and packing slips from the admin, but it does not email a branded PDF invoice for each order by default. An automation like this one fills that gap.

Can I make packing slips too?

Yes. Use a second Custom Request step with a packing slip design, without prices. Both PDFs can go into the same email or to different people.

What happens if an order has many products?

The invoice simply grows to more pages. Each page costs one credit, and table headers repeat on every page.

Is my customer data stored?

No. html-pdf.com does not store your HTML, and download links expire after 24 hours.

This page as markdown · text