Dynamic Stripe Customer Management and Invoice Generation - n8n Workflow

Use this powerful n8n workflow template to automate Stripe operations, including checking if a customer exists, creating new customers, generating invoices, and finalizing payments automatically using HTTP Request nodes.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Technical founders and business owners requiring automated billing systems.

  • Finance teams needing to streamline invoice generation on Stripe.

  • Users looking for advanced examples of using HTTP Request nodes within an n8n workflow to interact with external APIs.

  • Anyone searching for reliable n8n templates for payment processing.

Overview

Managing invoicing and customer creation manually can be time-consuming and error-prone. This sophisticated n8n workflow template solves this by providing a robust automation layer for Stripe.

Starting with a manual n8n trigger for easy testing, the flow first prepares the necessary data. It then intelligently checks the Stripe API to determine if a customer already exists using a targeted n8n node request. Based on the result, the core logic flow control directs the execution to either retrieve the existing customer ID or create a brand new customer record. Finally, it uses this gathered ID to generate a draft invoice, attach specific line items, and finalize the invoice, ensuring immediate and accurate billing. This is a crucial n8n workflow for any business relying on Stripe.

How it Works

The execution of this n8n workflow follows a precise logic path:


  1. Start: The flow begins with the 'When clicking ‘Test workflow’ n8n trigger, designed for initial setup and manual execution.

  2. Data Initialization: The 'Set invoice data' n8n node prepares essential details (like customer email and invoice amount) needed for subsequent steps.

  3. Customer Lookup: The 'Get Stripe Customer' n8n node sends an HTTP request to Stripe to search for the customer.

  4. Conditional Check: The 'Customer exists?' n8n node uses an If statement to analyze the response.

  5. Existing Customer Path (True): If the customer is found, the 'Set customer id' n8n node extracts the existing Stripe ID.

  6. New Customer Path (False): If the customer is not found, the 'Create customer' n8n node executes an HTTP request to register a new customer in Stripe.

  7. Invoice Generation: Both paths converge at the 'Create invoice' n8n node, which uses the retrieved or newly created customer ID to generate a new draft invoice.

  8. Item Addition: The 'Add item to invoice' n8n node then attaches the product or service line item details to the newly created invoice.

  9. Finalization: The n8n workflow concludes by executing the 'Finalize invoice' n8n node, setting the invoice to an 'open' or 'sent' status, completing the automation cycle.

Installation Guide

To deploy this n8n workflow template, follow these steps:


  1. Import: Copy the provided JSON data and paste it into your n8n instance under the Workflows section using the 'New' -> 'Import from JSON' option.

  2. Stripe Credentials: Since this n8n workflow relies on the Stripe API, you must configure HTTP Request authentication. You will need a Header Authentication method, typically using your Stripe Secret Key prefixed by Bearer .

  3. Node Configuration: Edit the 'Get Stripe Customer', 'Create customer', 'Create invoice', 'Add item to invoice', and 'Finalize invoice' n8n node components. Ensure the HTTP requests match your required Stripe API endpoints (e.g., /v1/customers, /v1/invoices).

  4. Data Setup: Update the 'Set invoice data' n8n node with the actual customer and product data you intend to use for testing.

  5. Test Run: Click the 'Execute Workflow' button (or the manual n8n trigger) to verify the process end-to-end.

Node Details

When clicking ‘Test workflow’ (manualTrigger): The initiating n8n trigger, ideal for developing and testing the n8n workflow logic before deploying a live trigger (like a Webhook or Schedule).
Set invoice data (Set): This fundamental n8n node defines static or test data (like email, currency, and line item description) that will be used dynamically throughout the n8n workflow.
Get Stripe Customer (httpRequest): Function: Queries the Stripe API using customer identifier data to check for existing records. Key Configuration: Must be configured with the correct Stripe API URL and necessary authentication headers.
Customer exists? (If): Function: A core logic flow control n8n node that splits the path based on whether the customer query returned a valid customer object (True) or an error/empty list (False).
Create customer (httpRequest): Function: Executes the Stripe API call to create a new customer record, used when the If n8n node determines no existing customer was found.
Set customer id (Set): Function: Extracts the ID of the existing customer from the Get Stripe Customer response, ensuring the subsequent invoice steps use the correct identifier.
Create invoice (httpRequest): Function: Initiates a draft invoice on Stripe, utilizing the customer ID secured in the previous steps.
Add item to invoice (httpRequest): Function: Appends the specific product or service item details (amount, quantity, description) to the newly created draft invoice ID.


  • Finalize invoice (httpRequest): Function: The final step of this n8n workflow. It changes the status of the draft invoice to ready for payment or emailing, concluding the automated billing process.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by

Transforming complexity into simplicity.

Featured*