8
n8n 中文网amn8n.com

从 Stripe API 获取自定义字段

中级

这是一个Finance, Building Blocks领域的自动化工作流,包含 7 个节点。主要使用 Filter, SplitOut, HttpRequest 等节点。 从 Stripe API 获取自定义字段

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "84ba6d895254e080ac2b4916d987aa66b000f88d4d919a6b9c76848f9b8a7616",
    "templateId": "2359"
  },
  "nodes": [
    {
      "id": "654e210f-08b1-4ba4-b464-9499084092a2",
      "name": "拆分 custom_fields",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        980,
        640
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "custom_fields"
      },
      "typeVersion": 1
    },
    {
      "id": "9b1a4071-7dd8-4d60-b077-d686fff40d24",
      "name": "Stripe | 获取最新结账会话1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        460,
        640
      ],
      "parameters": {
        "url": "=https://api.stripe.com/v1/checkout/sessions",
        "options": {
          "pagination": {
            "pagination": {
              "parameters": {
                "parameters": [
                  {
                    "name": "starting_after",
                    "value": "={{ $response.body.data.last().id }}"
                  }
                ]
              },
              "completeExpression": "={{ $response.body.has_more == false }}",
              "paginationCompleteWhen": "other"
            }
          }
        },
        "jsonQuery": "={\n  \"created\": {\n    \"gte\":{{ $today.minus(20, 'days').toSeconds() }},\n    \"lte\":{{ $today.toSeconds() }}\n  }\n}",
        "sendQuery": true,
        "specifyQuery": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "stripeApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "17016a73-5338-49c7-af8d-8587c778c2f6",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 252.741654751449,
        "height": 593.3373455805055,
        "content": "## 检索过去 7 天的所有结账会话"
      },
      "typeVersion": 1
    },
    {
      "id": "e46a5332-a008-4617-be57-eb22e713022d",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        545
      ],
      "parameters": {
        "color": 7,
        "width": 451.2991079615292,
        "height": 267.24226082469556,
        "content": "## 拆分数据以便于可视化"
      },
      "typeVersion": 1
    },
    {
      "id": "ebf8a12a-787c-4ab8-9060-2241bbf38489",
      "name": "### 需要帮助?",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        237
      ],
      "parameters": {
        "color": 7,
        "height": 598.2429925878827,
        "content": "## 选择您需要的自定义字段"
      },
      "typeVersion": 1
    },
    {
      "id": "e9c54905-dadb-4b5e-9ce0-cfe7d436c51e",
      "name": "按 custom_field 筛选",
      "type": "n8n-nodes-base.filter",
      "position": [
        1280,
        640
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4579d72e-8d48-4146-952d-9b5b400f5bce",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.custom_fields.key }}",
              "rightValue": "nickname"
            },
            {
              "id": "34197f40-9b41-46e4-8796-be3a86e4dcca",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.custom_fields.key }}",
              "rightValue": "job_title"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "14915079-68ba-48ab-9a9d-fe627aa2bd33",
      "name": "拆分所有数据",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        760,
        640
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "split all data": {
      "main": [
        [
          {
            "node": "split custom_fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "split custom_fields": {
      "main": [
        [
          {
            "node": "Filter by custom_field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stripe | Get latest checkout sessions1": {
      "main": [
        [
          {
            "node": "split all data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 财务, 构建模块

需要付费吗?

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

工作流信息
难度等级
中级
节点数量7
分类2
节点类型4
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Solomon

Solomon

@solomon

Freelance consultant from Brazil, specializing in automations and data analysis. I work with select clients, addressing their toughest projects. For business inquiries, email me at automations.solomon@gmail.com or message me on Telegram for a faster response.

外部链接
在 n8n.io 查看

分享此工作流