{
  "name": "Stripe dispute management with Google Sheets ledger & Gmail notifications",
  "nodes": [
    {
      "id": "67a71551-678b-4a04-bb39-a14e54c36c0c",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -128,
        208
      ]
    },
    {
      "id": "b72c4012-d202-450f-90a6-b99e392343af",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        512
      ],
      "parameters": {
        "width": null,
        "height": 320,
        "content": "Action: Evaluates the output of the Get Row(s) node.\n\nDescription: If the payment exists in the ledger (i.e., a row is found for that charge_id), the workflow continues to the Update Row node. If no r"
      }
    },
    {
      "id": "87cb1c73-99c3-409f-86fa-d49c97074a9a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        -384
      ],
      "parameters": {
        "width": null,
        "height": 432,
        "content": "Action: Sends an email to the customer using their email address from Stripe (customer_email).\n\nDescription: This node generates a personalized email notifying the customer that a dispute has been rai"
      }
    },
    {
      "id": "c8f1645c-d695-4861-b009-f905f64185fe",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -256
      ],
      "parameters": {
        "width": null,
        "height": 288,
        "content": "Action: Appends a new row into the Disputes sheet every time a new dispute is fetched.\n\nDescription: This step creates a historical audit log of all disputes ever raised. Every run adds a new entry, w"
      }
    },
    {
      "id": "f7312b74-0370-4282-bd6c-a47dda17d737",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        512
      ],
      "parameters": {
        "width": null,
        "height": 384,
        "content": "Action: Searches for a row in the Payments sheet where the charge_id matches the one in the current dispute.\n\nDescription: The Payments sheet acts as your master ledger of all payments. By looking up "
      }
    },
    {
      "id": "83a18437-73c4-4062-9681-1003e3064958",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -224
      ],
      "parameters": {
        "width": null,
        "height": 416,
        "content": "Action: Uses JavaScript to clean up the Stripe response and prepare only the most relevant fields. It also selects just the latest dispute from the list.\n\nDescription: This node extracts essential det"
      }
    },
    {
      "id": "48cba95b-90ac-47ed-879a-ac1a5a6f8283",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        400
      ],
      "parameters": {
        "width": null,
        "height": 320,
        "content": "Action: Sends a GET request to the Stripe API endpoint, using your Stripe secret key.\n\nDescription: This node retrieves the raw list of recent disputes from Stripe. The API returns all the dispute det"
      }
    },
    {
      "id": "33bd715b-5140-4af5-8734-37c90bb2abcc",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1216,
        512
      ],
      "parameters": {
        "width": null,
        "height": 384,
        "content": "Action: Updates the existing row in the Payments sheet with dispute-specific fields.\n\nDescription: This step enriches your Payments ledger with new details about the dispute . By keeping these values "
      }
    },
    {
      "id": "25b4f24d-99e0-448a-b7f7-7e84e3557243",
      "name": "Fetch Latest Disputes from Stripe",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        112,
        208
      ]
    },
    {
      "id": "acc142aa-346a-4812-9849-16ad5f1c4c95",
      "name": "Format Stripe Dispute Data",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        208
      ]
    },
    {
      "id": "b9356ab5-af6c-46db-b84b-4f906cc5f259",
      "name": "Log Dispute in Disputes Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        720,
        64
      ]
    },
    {
      "id": "81fc2bb6-7077-4b81-8d65-396685a6cb65",
      "name": "Find Payment in Ledger",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        720,
        352
      ]
    },
    {
      "id": "7c4e0a80-3377-4d2a-a424-36cd0f23a09b",
      "name": "Check if Payment Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        976,
        352
      ]
    },
    {
      "id": "bc710438-8e6f-4711-ba2b-11c3c9ea06ab",
      "name": "Update Payment Record with Dispute Info",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1264,
        336
      ]
    },
    {
      "id": "7f6a9fe0-6123-4b8a-9c13-5a24a6117043",
      "name": "Send Customer Dispute Notification Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1008,
        64
      ]
    }
  ],
  "connections": {
    "Find Payment in Ledger": {
      "main": [
        [
          {
            "node": "Check if Payment Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Payment Exists": {
      "main": [
        [
          {
            "node": "Update Payment Record with Dispute Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Stripe Dispute Data": {
      "main": [
        [
          {
            "node": "Log Dispute in Disputes Sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Find Payment in Ledger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Dispute in Disputes Sheet": {
      "main": [
        [
          {
            "node": "Send Customer Dispute Notification Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Latest Disputes from Stripe": {
      "main": [
        [
          {
            "node": "Format Stripe Dispute Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Fetch Latest Disputes from Stripe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}