🧾 Generate invoice PDFs from Stripe payments using TemplateFox, Gmail and Drive

⚡ 67 views · 🧾 Invoice Processing

Description

This workflow automatically generates and delivers professional invoice PDFs whenever a Stripe checkout session completes. It fetches the line items from Stripe, formats them into a clean invoice with your company details, generates a branded PDF via TemplateFox, emails it to the customer, and saves a copy to Google Drive.

Problem Solved

Without this automation, invoicing after a Stripe payment requires:

This workflow handles all of that automatically for every Stripe checkout, including proper invoice numbering, due dates, and tax calculations.

Who Can Benefit

Prerequisites

Setting Up Your Template

You need a TemplateFox invoice template for this workflow. You can:

  1. Start from an example — Browse invoice templates, pick one you like, and customize it in the visual editor to match your branding
  2. Create from scratch — Design your own invoice template in the TemplateFox editor

Once your template is ready, select it from the dropdown in the TemplateFox node — no need to copy template IDs manually.

Workflow Details

Step 1: Stripe Trigger Fires on every completed checkout session (checkout.session.completed). This captures successful payments with full customer and product details.

Step 2: Get Line Items An HTTP Request node calls the Stripe API to fetch the line items for the checkout session (product names, quantities, amounts). Stripe doesn’t include line items in the webhook payload, so this separate call is required.

Step 3: Format Invoice Data A Code node combines the Stripe session data and line items into a clean invoice structure: company details, client info (from Stripe customer), line items with prices, subtotal, tax, total, invoice number (auto-generated from date + session ID), and due date (Net 30).

Step 4: TemplateFox — Generate Invoice Select your invoice template from the dropdown — the node automatically loads your template’s fields. Map each field to the matching output from the Code node (e.g. client_company → {{ $json.client_company }}). TemplateFox generates a professional invoice PDF using your custom template.

Step 5a: Email Invoice Sends the invoice PDF link to the customer via Gmail with invoice number, amount, and due date.

Step 5b: Save to Google Drive Downloads the PDF and uploads it to a Google Drive folder for bookkeeping. Runs in parallel with the email step.

Customization Guidance

Note: This template uses the TemplateFox community node. Install it from Settings → Community Nodes.

🔗 Nodes Used

HTTP Request, Stripe Trigger, Google Drive, Gmail

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup