{
  "name": "Stripe payment: log, alert, thank you",
  "nodes": [
    {
      "parameters": {
        "events": [
          "charge.succeeded"
        ]
      },
      "id": "da52b7c1-cdcc-508a-b511-9e37ca135f20",
      "name": "Payment succeeded",
      "type": "n8n-nodes-base.stripeTrigger",
      "typeVersion": 1,
      "position": [
        200,
        300
      ],
      "webhookId": "aef571e6-8a48-5e5b-b2ff-bb4916d0395a"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "s1",
              "name": "date",
              "value": "={{ DateTime.fromSeconds($json.data.object.created).toFormat('yyyy-MM-dd') }}",
              "type": "string"
            },
            {
              "id": "s2",
              "name": "customer_email",
              "value": "={{ $json.data.object.billing_details.email }}",
              "type": "string"
            },
            {
              "id": "s3",
              "name": "amount",
              "value": "={{ $json.data.object.amount / 100 }}",
              "type": "number"
            },
            {
              "id": "s4",
              "name": "currency",
              "value": "={{ $json.data.object.currency.toUpperCase() }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "afd647dc-2755-50ce-b6e0-5956c1767a62",
      "name": "Tidy the data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        400,
        300
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      },
      "id": "87692870-2345-5b71-ab0e-81702eebd3ab",
      "name": "Log the sale",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        600,
        300
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "#general",
          "mode": "name"
        },
        "text": "=New sale: {{ $('Tidy the data').item.json.amount }} {{ $('Tidy the data').item.json.currency }} from {{ $('Tidy the data').item.json.customer_email }}",
        "otherOptions": {}
      },
      "id": "cdc8fcc3-87f7-519a-ae96-4a097698808a",
      "name": "Tell the team",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        800,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c6ea3868-d8e2-4c86-85c4-264763a8d95f",
              "leftValue": "={{ $('Tidy the data').item.json.customer_email }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "bc8bd8a8-e1f6-5ab3-99a2-c7c425dc9b5d",
      "name": "Has an email",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2,
      "position": [
        1000,
        300
      ]
    },
    {
      "parameters": {
        "sendTo": "={{ $('Tidy the data').item.json.customer_email }}",
        "subject": "Thank you!",
        "emailType": "text",
        "message": "Hi,\n\nThanks so much for your purchase. If anything is unclear, just reply to this email and I'll help.\n\nBest,\nYOUR NAME",
        "options": {}
      },
      "id": "b6079c11-d498-54a1-9ed3-78d2b4a5cc1f",
      "name": "Thank the customer",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1200,
        300
      ]
    },
    {
      "parameters": {
        "content": "## Draft, not yet tested\nThis workflow was written by Automation Recipes and has NOT been run end to end yet.\n\nAfter importing: open each node, connect your own accounts (credentials), and fill in anything left blank (sheet URL, Slack channel, label names). Then run it once by hand with test data before turning it on.",
        "height": 260,
        "width": 420
      },
      "id": "4370494d-bf76-5f0f-99d8-7457c096901b",
      "name": "Read me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        20
      ]
    }
  ],
  "connections": {
    "Payment succeeded": {
      "main": [
        [
          {
            "node": "Tidy the data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tidy the data": {
      "main": [
        [
          {
            "node": "Log the sale",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log the sale": {
      "main": [
        [
          {
            "node": "Tell the team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tell the team": {
      "main": [
        [
          {
            "node": "Has an email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has an email": {
      "main": [
        [
          {
            "node": "Thank the customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}