使用Stripe、Google Drive和Google Sheets归档付款收据

高级

这是一个Content Creation、Multimodal AI领域的自动化工作流,包含 21 个节点。主要使用 If、Gmail、SplitOut、GoogleDrive、HttpRequest 等节点。 自动化付款收据:通过Stripe和Google Workspace发送邮件、归档和跟踪

前置要求
  • Google 账号和 Gmail API 凭证
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "gr2rafzxOw1ks4Bd",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Stripe、Google Drive 和 Google Sheets 归档付款收据",
  "tags": [],
  "nodes": [
    {
      "id": "cdfad755-0724-4156-b4ec-04a671a85013",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1104,
        -32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a511f05a-495d-4066-af54-9b977ca59aec",
      "name": "获取发票",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -848,
        -32
      ],
      "parameters": {
        "url": "https://api.stripe.com/v1/invoices?limit=5",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer ${{credential.stripe.secret.key}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c24bc890-1e3e-4334-88a2-69fcd2c0be5e",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        128
      ],
      "parameters": {
        "height": 272,
        "content": "获取发票"
      },
      "typeVersion": 1
    },
    {
      "id": "1d8ec260-aa38-4dfa-8f73-98ea5e5e671c",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        -544
      ],
      "parameters": {
        "height": 288,
        "content": "发送收据邮件 –"
      },
      "typeVersion": 1
    },
    {
      "id": "94dac976-2243-463c-8ac0-5bf2b3061a95",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        80
      ],
      "parameters": {
        "height": 240,
        "content": "下载文件"
      },
      "typeVersion": 1
    },
    {
      "id": "afba0c2a-08e2-4d19-ab7f-29e79b70c29a",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -352
      ],
      "parameters": {
        "height": 256,
        "content": "IF(已发送收据?)"
      },
      "typeVersion": 1
    },
    {
      "id": "64a4d0dc-6d8f-4728-adaf-ce509afce060",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        96
      ],
      "parameters": {
        "height": 224,
        "content": "IF(已付款?)"
      },
      "typeVersion": 1
    },
    {
      "id": "d776ef15-e417-4449-a2a5-e1c53319f87e",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -368
      ],
      "parameters": {
        "height": 288,
        "content": "展开列表"
      },
      "typeVersion": 1
    },
    {
      "id": "8c3f5034-5e26-429d-9d30-4f56dd99db5d",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        288
      ],
      "parameters": {
        "height": 288,
        "content": "添加到分类账"
      },
      "typeVersion": 1
    },
    {
      "id": "aacfb7d2-7acb-4b1a-a7c7-39069a01055f",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        272
      ],
      "parameters": {
        "height": 208,
        "content": "上传发票 PDF"
      },
      "typeVersion": 1
    },
    {
      "id": "b107aa2b-90b9-48fe-98dc-d828012444e7",
      "name": "展开列表",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -336,
        -48
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "=data"
      },
      "typeVersion": 1
    },
    {
      "id": "a83ac85d-4737-44bc-877e-6844389a9689",
      "name": "IF(已付款?)",
      "type": "n8n-nodes-base.if",
      "position": [
        -128,
        -48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3e81fec9-095e-4ada-b6d0-1e7db2d0b446",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "paid"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d7fec273-c100-43bf-9ddc-311f31b34493",
      "name": "IF(已发送收据?)",
      "type": "n8n-nodes-base.if",
      "position": [
        128,
        -64
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b8f92661-228b-457c-b6ae-263ba3b034da",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.metadata.receipt_sent }}",
              "rightValue": "false"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c2dbb175-469f-4c19-8466-08afba27115d",
      "name": "下载文件",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        464,
        -80
      ],
      "parameters": {
        "url": "={{$json[\"invoice_pdf\"]}}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "49c0e75c-8b77-4d43-bc71-60b6bd02519a",
      "name": "发送收据邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        736,
        -240
      ],
      "webhookId": "0c82c299-6938-42ed-bda6-5007d79af34f",
      "parameters": {
        "sendTo": "={{$json.customer_email}}",
        "message": "=Hi {{$json.customer_name}},  \n\nThanks for your payment.  \nAttached is your receipt for invoice {{$json.number}} (Total: {{$json.currency}} {{$json.total}}).  \n\nRegards,  \nYour Company\n",
        "options": {
          "attachmentsUi": {
            "attachmentsBinary": [
              {}
            ]
          }
        },
        "subject": "=Payment Receipt - Invoice {{$json.number}}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RchiXdmY8WaQhOSJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b4401084-8c70-47f3-8804-637c9bef9834",
      "name": "上传发票 PDF",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        768,
        112
      ],
      "parameters": {
        "name": "={{$json[\"number\"]}}.pdf",
        "driveId": {
          "__rl": true,
          "mode": "url",
          "value": "{{YOUR_GOOGLE_DRIVE_URL}}"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "url",
          "value": "{{YOUR_URL}}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "E7nEqUL27GUx1xHa",
          "name": "Techdome Account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "1efedacb-1e07-4e23-ab7c-19e0e21b6b08",
      "name": "添加到分类账",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1040,
        112
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": "{{YOUR_URL}}"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "{{YOUR_SPREADSHEET_URL}}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "kpPEOLCGn963qpoh",
          "name": "automations@techdome.ai"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "f535062a-1ced-46d3-8b4e-73aaeb6c6e3b",
      "name": "错误日志记录",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -384,
        272
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": "{{YOUR_URL}}"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "{{YOUR_SPREADSHEET_URL}}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "kpPEOLCGn963qpoh",
          "name": "automations@techdome.ai"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "6f14b401-170b-4fb8-ae5d-aa079f7549cb",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        432
      ],
      "parameters": {
        "height": 320,
        "content": "操作:将工作流错误和故障记录到专用的错误跟踪电子表格中,用于监控和调试目的。"
      },
      "typeVersion": 1
    },
    {
      "id": "4cd976cd-8739-47ad-bddd-25d0973c3cd8",
      "name": "检查 API 响应",
      "type": "n8n-nodes-base.if",
      "position": [
        -608,
        -32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e2130860-3ee5-490c-9eb0-6a6e02e9f41e",
              "operator": {
                "type": "array",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.data }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "89781301-0ca4-4dc7-924f-0ea978d6bc83",
      "name": "便签 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        -400
      ],
      "parameters": {
        "height": 336,
        "content": "操作:在尝试处理发票之前,验证 Stripe API 是否返回了正确的数据数组。"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d54ecc14-b03b-46b3-88c8-1b25d10351db",
  "connections": {
    "IF (Paid?)": {
      "main": [
        [
          {
            "node": "IF (Already Receipted?)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Expand List": {
      "main": [
        [
          {
            "node": "IF (Paid?)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Send Receipt Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload Invoice PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Invoices": {
      "main": [
        [
          {
            "node": "Check API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check API Response": {
      "main": [
        [
          {
            "node": "Expand List",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": " Error Logging",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Receipt Email": {
      "main": [
        []
      ]
    },
    "Upload Invoice PDF": {
      "main": [
        [
          {
            "node": "Append to Ledger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF (Already Receipted?)": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Fetch Invoices",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

这是一个高级难度的工作流,适用于Content Creation、Multimodal AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量21
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Rahul Joshi

Rahul Joshi

@rahul08

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.

外部链接
在 n8n.io 上查看 →

分享此工作流