{
  "name": "Rescue Failed Stripe Payments With an Automatic Email Nudge",
  "nodes": [
    {
      "name": "Stripe — Payment Failed",
      "type": "n8n-nodes-base.stripe",
      "typeVersion": 1,
      "parameters": {
        "events": [
          "invoice.payment_failed"
        ]
      },
      "notes": "Subscribe to the failed-payment event.",
      "position": [
        260,
        300
      ]
    },
    {
      "name": "Capture Reason",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "928",
              "name": "email",
              "value": "={{ $json.data.object.customer_email }}",
              "type": "string"
            },
            {
              "id": "929",
              "name": "amount",
              "value": "={{ $json.data.object.amount_due / 100 }}",
              "type": "string"
            },
            {
              "id": "930",
              "name": "reason",
              "value": "={{ $json.data.object.last_payment_error }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "notes": "",
      "position": [
        500,
        300
      ]
    },
    {
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2,
      "parameters": {
        "subject": "=Your payment of {{ $json.amount }} didn't go through. Updat",
        "text": "={{ $json.summary }}"
      },
      "notes": "Add SMTP credentials (or swap for the Gmail node).",
      "position": [
        740,
        300
      ]
    },
    {
      "name": "Respond / Finish",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "parameters": {},
      "notes": "End of flow — extend with extra steps as needed.",
      "position": [
        980,
        300
      ]
    }
  ],
  "connections": {
    "Stripe — Payment Failed": {
      "main": [
        [
          {
            "node": "Capture Reason",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture Reason": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email": {
      "main": [
        [
          {
            "node": "Respond / Finish",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
