{
  "name": "Rescue Failed PayPal Payments With an Automatic SMS Nudge",
  "nodes": [
    {
      "name": "PayPal — Payment Failed",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "parameters": {
        "method": "POST",
        "url": "https://api.example.com/replace-with-real-endpoint",
        "sendBody": true,
        "options": {}
      },
      "notes": "PayPal has no dedicated n8n node — use an HTTP Request to the PayPal API. Subscribe to the failed-payment event.",
      "position": [
        260,
        300
      ]
    },
    {
      "name": "Capture Reason",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "949",
              "name": "email",
              "value": "={{ $json.data.object.customer_email }}",
              "type": "string"
            },
            {
              "id": "950",
              "name": "amount",
              "value": "={{ $json.data.object.amount_due / 100 }}",
              "type": "string"
            },
            {
              "id": "951",
              "name": "reason",
              "value": "={{ $json.data.object.last_payment_error }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "notes": "",
      "position": [
        500,
        300
      ]
    },
    {
      "name": "Send SMS",
      "type": "n8n-nodes-base.twilio",
      "typeVersion": 1,
      "parameters": {
        "operation": "send",
        "message": "=Your payment of {{ $json.amount }} didn't go through. Update your card here: [link]"
      },
      "notes": "Use a Twilio number; WhatsApp requires an approved sender.",
      "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": {
    "PayPal — Payment Failed": {
      "main": [
        [
          {
            "node": "Capture Reason",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture Reason": {
      "main": [
        [
          {
            "node": "Send SMS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send SMS": {
      "main": [
        [
          {
            "node": "Respond / Finish",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
