{
  "id": "WpxFbb7TDDNk8GNB",
  "name": "Stripe Payment Concierge \u2014 AI Thank-You & Receipt on Every Payment",
  "tags": [],
  "nodes": [
    {
      "id": "56048862-32e5-46b5-9650-830455e79341",
      "name": "Payment Succeeded",
      "type": "n8n-nodes-base.stripeTrigger",
      "position": [
        -1120,
        320
      ],
      "parameters": {
        "events": [
          "charge.succeeded"
        ]
      },
      "typeVersion": 1
    },
    {
      "id": "d1f2e26e-9403-4c2d-8097-8f0c872bc189",
      "name": "Normalize Payment",
      "type": "n8n-nodes-base.set",
      "position": [
        -720,
        320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "p_name",
              "name": "customer_name",
              "type": "string",
              "value": "={{ $json.data.object.billing_details?.name ?? \"there\" }}"
            },
            {
              "id": "p_email",
              "name": "customer_email",
              "type": "string",
              "value": "={{ $json.data.object.billing_details?.email ?? $json.data.object.receipt_email ?? \"\" }}"
            },
            {
              "id": "p_amount",
              "name": "amount",
              "type": "number",
              "value": "={{ ($json.data.object.amount ?? 0) / 100 }}"
            },
            {
              "id": "p_curr",
              "name": "currency",
              "type": "string",
              "value": "={{ ($json.data.object.currency ?? \"usd\").toUpperCase() }}"
            },
            {
              "id": "p_desc",
              "name": "description",
              "type": "string",
              "value": "={{ $json.data.object.description ?? \"Your purchase\" }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "beb507d4-f21f-4648-a142-1710cfad7a89",
      "name": "AI Thank-You + Receipt",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -368,
        320
      ],
      "parameters": {
        "text": "=Write a warm thank-you and receipt confirmation.\n\nCustomer: {{ $json.customer_name }}\nAmount: {{ $json.currency }} {{ $json.amount }}\nFor: {{ $json.description }}",
        "options": {
          "systemMessage": "You write friendly, professional post-payment emails. response_subject is short and warm. response_message is clean HTML (<p> paragraphs) that thanks the customer by first name, confirms the exact amount, currency and what it was for, and reassures them help is available if needed. internal_summary is one plain sentence for the finance log. Never invent order numbers, discounts, or promises. Return ONLY the JSON object."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "4b0fb1be-98a8-4441-9345-631520324d04",
      "name": "Claude Sonnet 4.6",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -368,
        528
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-6",
          "cachedResultName": "Claude Sonnet 4.6"
        },
        "options": {
          "temperature": 0.4,
          "maxTokensToSample": 700
        }
      },
      "typeVersion": 1.5
    },
    {
      "id": "7c2fa795-8265-42ba-86ae-27b8e311efcb",
      "name": "Receipt Schema",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -224,
        528
      ],
      "parameters": {
        "jsonSchemaExample": "{ \"response_subject\": \"Thank you for your purchase, Priya\", \"response_message\": \"<p>Hi Priya,</p><p>Thank you for your payment of USD 49.99 for Pro plan (annual).</p>\", \"internal_summary\": \"Priya paid USD 49.99 for the annual Pro plan.\" }"
      },
      "typeVersion": 1.3
    },
    {
      "id": "0a407e6e-7785-49f0-899a-3dc0c7a6173f",
      "name": "Shape Payment",
      "type": "n8n-nodes-base.set",
      "position": [
        80,
        320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "sp_name",
              "name": "customer_name",
              "type": "string",
              "value": "={{ $(\"Normalize Payment\").item.json.customer_name }}"
            },
            {
              "id": "sp_email",
              "name": "customer_email",
              "type": "string",
              "value": "={{ $(\"Normalize Payment\").item.json.customer_email }}"
            },
            {
              "id": "sp_amount",
              "name": "amount",
              "type": "number",
              "value": "={{ $(\"Normalize Payment\").item.json.amount }}"
            },
            {
              "id": "sp_curr",
              "name": "currency",
              "type": "string",
              "value": "={{ $(\"Normalize Payment\").item.json.currency }}"
            },
            {
              "id": "sp_desc",
              "name": "description",
              "type": "string",
              "value": "={{ $(\"Normalize Payment\").item.json.description }}"
            },
            {
              "id": "sp_subj",
              "name": "response_subject",
              "type": "string",
              "value": "={{ $json.response_subject }}"
            },
            {
              "id": "sp_msg",
              "name": "response_message",
              "type": "string",
              "value": "={{ $json.response_message }}"
            },
            {
              "id": "sp_sum",
              "name": "summary",
              "type": "string",
              "value": "={{ $json.internal_summary }}"
            },
            {
              "id": "sp_ts",
              "name": "logged_at",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "baf7d5cb-8e89-48a0-b895-0579aca47963",
      "name": "Log Payment",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        576,
        192
      ],
      "parameters": {
        "columns": {
          "value": {
            "amount": "={{ $(\"Shape Payment\").item.json.amount }}",
            "summary": "={{ $(\"Shape Payment\").item.json.summary }}",
            "currency": "={{ $(\"Shape Payment\").item.json.currency }}",
            "logged_at": "={{ $(\"Shape Payment\").item.json.logged_at }}",
            "description": "={{ $(\"Shape Payment\").item.json.description }}",
            "customer_name": "={{ $(\"Shape Payment\").item.json.customer_name }}",
            "customer_email": "={{ $(\"Shape Payment\").item.json.customer_email }}"
          },
          "schema": [
            {
              "id": "customer_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "customer_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "customer_email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "customer_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "amount",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "currency",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "logged_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "logged_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "payment_log"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "b1c08976-1e83-4b43-9903-d4a32ebdd76d",
      "name": "Email Thank-You",
      "type": "n8n-nodes-base.gmail",
      "onError": "continueRegularOutput",
      "maxTries": 3,
      "position": [
        576,
        432
      ],
      "parameters": {
        "sendTo": "={{ $(\"Shape Payment\").item.json.customer_email }}",
        "message": "={{ $(\"Shape Payment\").item.json.response_message }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $(\"Shape Payment\").item.json.response_subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 2.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "6fdcb5e1-3ccc-4a2c-8621-772addaa09a7",
      "name": "Sticky Note 40411ab8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        -192
      ],
      "parameters": {
        "color": 4,
        "width": 552,
        "height": 456,
        "content": "## \ud83d\udcb3 Stripe Payment Concierge\n\nWhen a Stripe payment succeeds, AI instantly sends a warm, personalized thank-you + receipt confirmation and logs the payment for your finance records.\n\n**Flow:** Stripe payment \u2192 Normalize \u2192 AI thank-you \u2192 Shape \u2192 log + email.\n\n### Setup\n1. Connect **Stripe**, **Anthropic**, and **Gmail** credentials.\n2. Activate \u2014 Stripe registers the webhook automatically.\n3. Take a test payment to see the flow run."
      },
      "typeVersion": 1
    },
    {
      "id": "9dcf7e1d-dbd2-4bf0-9f32-91ee00e15d45",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        560
      ],
      "parameters": {
        "width": 320,
        "height": 240,
        "content": "### \ud83d\udfe2 Payment Succeeded\n**Type:** Stripe Trigger\n**Function:** Listens for successful payments from your Stripe account and automatically kicks off the workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "f4bc85b3-8604-4e8c-9921-f4e4f133639f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        560
      ],
      "parameters": {
        "width": 352,
        "height": 192,
        "content": "### \ud83d\udee0\ufe0f Normalize Payment\n**Type:** Data Manipulation (Manual)\n**Function:** Cleans up and structures the raw incoming Stripe payment data so the AI can easily understand it."
      },
      "typeVersion": 1
    },
    {
      "id": "d0be5211-c79e-4b51-a8da-5a136bff4bfe",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        688
      ],
      "parameters": {
        "width": 368,
        "height": 256,
        "content": "### \ud83e\udd16 AI Thank-You + Receipt\n**Type:** AI Agent\n**Function:** Generates the warm, personalized thank-you message and receipt confirmation. \n**Connected Sub-nodes:**\n- Chat Model: Claude Sonnet 4.6\n- Memory\n- Tool\n- Output Parser: Receipt Schema"
      },
      "typeVersion": 1
    },
    {
      "id": "48a61a87-d41d-4308-b5d7-7f00ce27a08c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        688
      ],
      "parameters": {
        "width": 304,
        "height": 224,
        "content": "### \ud83d\udcd0 Shape Payment\n**Type:** Data Manipulation (Manual)\n**Function:** Takes the parsed output from the AI and maps it into the exact fields required for the logging and emailing steps."
      },
      "typeVersion": 1
    },
    {
      "id": "64886107-241a-4cad-b613-1b1210734af8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        112
      ],
      "parameters": {
        "width": 384,
        "height": 224,
        "content": "### \ud83d\udcca Log Payment\n**Type:** Spreadsheet/Database (e.g., Google Sheets or Airtable)\n**Function:** Records the payment details and customer info into your finance table for tracking and reconciliation."
      },
      "typeVersion": 1
    },
    {
      "id": "c47e4cd3-8ca2-42d3-bd1d-45c404661033",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        656
      ],
      "parameters": {
        "width": 448,
        "height": 240,
        "content": "### \u2709\ufe0f Email Thank-You\n**Type:** Gmail (Action: Send Message)\n**Function:** Sends the final, personalized AI-generated thank-you and receipt email directly to the customer."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "ec442a92-f92f-4e6e-b4ea-9bce4c8242df",
  "nodeGroups": [],
  "connections": {
    "Shape Payment": {
      "main": [
        [
          {
            "node": "Log Payment",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email Thank-You",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receipt Schema": {
      "ai_outputParser": [
        [
          {
            "node": "AI Thank-You + Receipt",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Claude Sonnet 4.6": {
      "ai_languageModel": [
        [
          {
            "node": "AI Thank-You + Receipt",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Payment": {
      "main": [
        [
          {
            "node": "AI Thank-You + Receipt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Payment Succeeded": {
      "main": [
        [
          {
            "node": "Normalize Payment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Thank-You + Receipt": {
      "main": [
        [
          {
            "node": "Shape Payment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}