This workflow corresponds to n8n.io template #12315 — we link there as the canonical source.
This workflow follows the Gmail → OpenAI recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "nBenN3tnFtNNMhYl",
"name": "Automated Stripe Expired Charge Recovery with AI Reminders",
"tags": [],
"nodes": [
{
"id": "51e8deea-68e5-48e5-97bf-81bf43732b3f",
"name": "Charge Expired Event",
"type": "n8n-nodes-base.stripeTrigger",
"position": [
352,
-48
],
"parameters": {
"events": [
"charge.expired"
]
},
"typeVersion": 1
},
{
"id": "c4411bfd-e3ac-4b27-92e5-e6fbf665278c",
"name": "Workflow Configuration",
"type": "n8n-nodes-base.set",
"position": [
576,
-48
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "id-1",
"name": "companyName",
"type": "string",
"value": "<__PLACEHOLDER_VALUE__Your Company Name__>"
},
{
"id": "id-2",
"name": "supportEmail",
"type": "string",
"value": "<__PLACEHOLDER_VALUE__Your Support Email__>"
},
{
"id": "id-3",
"name": "currencySymbol",
"type": "string",
"value": "$"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "c11a0736-62f3-45be-b67a-3335b82db498",
"name": "Extract Customer & Payment Data",
"type": "n8n-nodes-base.set",
"position": [
800,
-48
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "id-1",
"name": "customerName",
"type": "string",
"value": "={{ $json.data.object.billing_details.name || 'Valued Customer' }}"
},
{
"id": "id-2",
"name": "customerEmail",
"type": "string",
"value": "={{ $json.data.object.billing_details.email }}"
},
{
"id": "id-3",
"name": "chargeAmount",
"type": "string",
"value": "={{ ($json.data.object.amount / 100).toFixed(2) }}"
},
{
"id": "id-4",
"name": "currency",
"type": "string",
"value": "={{ $json.data.object.currency.toUpperCase() }}"
},
{
"id": "id-5",
"name": "chargeId",
"type": "string",
"value": "={{ $json.data.object.id }}"
},
{
"id": "id-6",
"name": "customerId",
"type": "string",
"value": "={{ $json.data.object.customer }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "418a2afb-c6f2-47b1-8dc1-39323267dc52",
"name": "Generate Payment Reminder",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1024,
-48
],
"parameters": {
"options": {
"instructions": "=You are a professional customer service assistant for {{ $('Workflow Configuration').first().json.companyName }}. Your task is to generate a polite, empathetic, and professional payment reminder email.\n\nGuidelines:\n1. Be friendly and understanding - acknowledge that payment issues happen\n2. Clearly state the amount due and that the previous payment attempt expired\n3. Provide a clear call-to-action that a new invoice will be sent\n4. Keep the tone professional but warm\n5. Keep the message concise (3-4 short paragraphs)\n6. Do not include subject line - only the email body\n7. Sign off with the company name\n\nReturn ONLY the email body text, no subject line or additional formatting."
},
"responses": {
"values": [
{
"content": "=Generate a professional and friendly payment reminder email for a customer whose payment has expired. Customer name: {{ $json.customerName }}, Amount: {{ $('Workflow Configuration').first().json.currencySymbol }}{{ $json.chargeAmount }} {{ $json.currency }}"
}
]
},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "bf61a8fe-ec12-48c7-88d8-9b51a521e027",
"name": "Create New Invoice",
"type": "n8n-nodes-base.stripe",
"position": [
1376,
-48
],
"parameters": {
"amount": "={{ Math.round($json.chargeAmount * 100) }}",
"currency": "={{ $json.currency.toLowerCase() }}",
"resource": "charge",
"operation": "create",
"customerId": "={{ $json.customerId }}",
"additionalFields": {
"description": "=Payment retry for expired charge {{ $json.chargeId }}"
}
},
"typeVersion": 1
},
{
"id": "55b5ed7b-2759-4683-9b2d-fce31b7a6ed9",
"name": "Send Reminder Email",
"type": "n8n-nodes-base.gmail",
"position": [
1600,
-48
],
"parameters": {
"sendTo": "={{ $('Extract Customer & Payment Data').first().json.customerEmail }}",
"message": "={{ $('Generate Payment Reminder').first().json.message }}",
"options": {
"senderName": "={{ $('Workflow Configuration').first().json.companyName }}"
},
"subject": "=Payment Reminder - {{ $('Workflow Configuration').first().json.companyName }}"
},
"typeVersion": 2.1
},
{
"id": "19340ba5-67d4-4691-b5cb-a6ef87a956d5",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-160,
-240
],
"parameters": {
"width": 432,
"height": 624,
"content": "## Overview\nThis workflow automatically handles expired or failed Stripe payments. When a charge expires, it triggers the workflow, drafts a professional AI-generated payment reminder, creates a new Stripe invoice, and optionally sends the reminder to the customer via Email or Slack.\n\n## How it works\n1. Stripe trigger detects expired payment\n2. Set node normalizes customer and payment data\n3. OpenAI node drafts payment reminder message\n4. Stripe node generates a new invoice\n5. Optional Email/Slack node sends message to customer or internal team\n\n## Setup Instructions\n- Stripe: Connect Stripe account in n8n and configure trigger for 'charge.expired'\n- OpenAI: Add API credentials\n- Email/Slack: Configure Email node or Slack notification for sending reminders\n- Optional: Customize AI prompt for brand tone and messaging style\n"
},
"typeVersion": 1
},
{
"id": "30ffcfa8-684b-4019-81bd-68c87db774db",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
304,
-256
],
"parameters": {
"color": 7,
"height": 464,
"content": "## Stripe\n\nListen for 'charge.expired' or 'invoice.payment_failed' events in Stripe. Make sure the credentials are connected.\n"
},
"typeVersion": 1
},
{
"id": "a0df4841-bc5e-4bf2-a6cd-03b64aaa30fe",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
560,
-256
],
"parameters": {
"color": 7,
"width": 384,
"height": 480,
"content": "## Configure \n\nMap the following fields:\n- Customer name\n- Customer email\n- Charge amount\n- Previous invoice ID\n- Currency\n"
},
"typeVersion": 1
},
{
"id": "1dae3263-6b77-4965-be05-c29eab19ba86",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
960,
-256
],
"parameters": {
"color": 7,
"width": 368,
"height": 480,
"content": "## AI prompt example:\n\"Write a professional, friendly payment reminder for {customer_name} regarding their expired charge of {amount} {currency}. Mention that a new invoice has been generated. Keep it polite and concise.\"\n"
},
"typeVersion": 1
},
{
"id": "b3ae0fd4-53d5-4351-b905-f734d29b499d",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1344,
-256
],
"parameters": {
"color": 7,
"height": 480,
"content": "## New Invoice\n\nCreate a new invoice for the customer with the same amount and currency. Use previous invoice metadata to reference subscription or product.\n"
},
"typeVersion": 1
},
{
"id": "bc7fac2b-ea52-4537-9a2e-21be273b78fa",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1600,
-256
],
"parameters": {
"color": 7,
"height": 480,
"content": "## Send\n\nSend the AI-generated reminder to the customer via email or alert internal staff on Slack. Ensure no sensitive data is exposed.\n"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "1c0fb6f7-f623-4139-b81f-88b443b60c1f",
"connections": {
"Create New Invoice": {
"main": [
[
{
"node": "Send Reminder Email",
"type": "main",
"index": 0
}
]
]
},
"Charge Expired Event": {
"main": [
[
{
"node": "Workflow Configuration",
"type": "main",
"index": 0
}
]
]
},
"Workflow Configuration": {
"main": [
[
{
"node": "Extract Customer & Payment Data",
"type": "main",
"index": 0
}
]
]
},
"Generate Payment Reminder": {
"main": [
[
{
"node": "Create New Invoice",
"type": "main",
"index": 0
}
]
]
},
"Extract Customer & Payment Data": {
"main": [
[
{
"node": "Generate Payment Reminder",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Businesses using Stripe subscriptions or one-time payments who want to automatically follow up with customers after a failed payment. Detects expired or failed charges in Stripe Drafts AI-generated payment reminders for customers Creates a new Stripe invoice for the failed…
Source: https://n8n.io/workflows/12315/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This intelligent email automation workflow helps you maximize engagement through domain-based outreach. It utilizes AI-powered personalization and strategic follow-ups to increase response rates. The
Complete AI-powered sales system Automates lead capture, qualification, and follow-up from multiple channels. AI INTELLIGENCE:
An automated quote generation system that monitors your inbox, classifies quote requests using AI, calculates intelligent pricing based on historical data, and provides a professional dashboard for re
Send a target niche and location via Telegram message Workflow discovers businesses via Google Maps API AI enriches contacts with email and LinkedIn data via Serper GPT-4o scores and qualifies each le
What it is An automated LinkedIn content system that takes a simple form (idea + optional file), generates LinkedIn posts with OpenAI, stores them in Notion, builds Google Slides carousels, and auto-p