8
n8n 中文网amn8n.com

n8n支付协调器与1Shot API

高级

这是一个Crypto Trading, Multimodal AI领域的自动化工作流,包含 27 个节点。主要使用 If, Code, Webhook, OneShot, OneShotSynch 等节点。 使用x402和1Shot API创建自托管区块链支付处理器

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "iOBvq8tJmbslKLvM",
  "meta": {
    "instanceId": "62f017ec8f130d172e2e5f39bbf09515036bfd403dfa60fe06f5ab14b78705d0",
    "templateCredsSetupCompleted": true
  },
  "name": "n8n 支付协调器与 1Shot API",
  "tags": [
    {
      "id": "ChlnN7rtKHJMnWmM",
      "name": "x402",
      "createdAt": "2025-06-19T04:23:28.149Z",
      "updatedAt": "2025-06-19T04:23:28.149Z"
    }
  ],
  "nodes": [
    {
      "id": "18ef87da-599a-4aa9-89cb-dab6ac024abe",
      "name": "模拟支付",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        672,
        32
      ],
      "parameters": {
        "params": "={\n  \"from\": \"{{ $json.decodedXPayment.payload.authorization.from }}\",\n  \"to\": \"{{ $json.decodedXPayment.payload.authorization.to }}\",\n  \"value\": \"{{ $json.decodedXPayment.payload.authorization.value }}\",\n  \"validAfter\": \"{{ $json.decodedXPayment.payload.authorization.validAfter }}\",\n  \"validBefore\": \"{{ $json.decodedXPayment.payload.authorization.validBefore }}\",\n  \"nonce\": \"{{ $json.decodedXPayment.payload.authorization.nonce }}\",\n  \"signature\": \"{{ $json.decodedXPayment.payload.signature }}\"\n} ",
        "operation": "simulate",
        "contractMethodId": "={{ $json.paymentConfig.contractMethodId }}"
      },
      "credentials": {
        "oneShotOAuth2Api": {
          "id": "05rDRla9Nl1rkXlv",
          "name": "x402 Facilitator"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "68d961ac-3d63-40ff-aecb-acb5d3c8e8f4",
      "name": "查询支付配置",
      "type": "n8n-nodes-base.code",
      "onError": "continueErrorOutput",
      "position": [
        224,
        256
      ],
      "parameters": {
        "jsCode": "const fromToken = $input.first().json.body.paymentRequirements.asset;\nconst fromChain = $input.first().json.body.paymentRequirements.network;\n\nconst config = {\n  \"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913\": {\n    tokenAddress: \"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913\",\n    chain: \"8453\",\n    name: \"USD Coin\",\n    version: \"2\",\n    contractMethodId: \"8445805a-0807-4ccf-a44d-6d4210a22787\",\n    network: \"base-mainnet\"\n  },\n  \"0x036cbd53842c5426634e7929541ec2318f3dcf7e\": {\n    tokenAddress: \"0x036cbd53842c5426634e7929541ec2318f3dcf7e\",\n    chain: \"84532\",\n    name: \"USDC\",\n    version: \"2\",\n    contractMethodId: \"adcf8d1f-1110-460a-9779-fe0bd1d9f9af\",\n    network: \"base-sepolia\"\n  },\n  \"0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e\": {\n    tokenAddress: \"0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e\",\n    chain: \"43114\",\n    name: \"USD Coin\",\n    version: \"2\",\n    contractMethodId: \"ed87ea0a-074a-487a-9f7e-226182d83a96\",\n    network: \"avalanche\"\n  },\n  \"0xaf88d065e77c8cc2239327c5edb3a432268e5831\": {\n    tokenAddress: \"0xaf88d065e77c8cc2239327c5edb3a432268e5831\",\n    chain: \"42161\",\n    name: \"USD Coin\",\n    version: \"2\",\n    contractMethodId: \"5c8e4b9b-b2f2-4882-9ca0-7fbc8b1d4d9f\",\n    network: \"arbitrum\"\n  }\n};\n\n\n\n// Check if fromToken exists in config\nif (!config[fromToken.toLowerCase()]) {\n  throw new Error(`Token ${fromToken} not found in configuration`);\n}\n\n// Optionally you could also validate the chain if needed\nif (config[fromToken.toLowerCase()].network !== fromChain) {\n  throw new Error(`Invalid chain for token ${fromToken} on <${fromChain}>`);\n}\n\n// Add the parsed JSON object to the input\n$input.first().json.paymentConfig = config[fromToken.toLowerCase()];\n\nreturn $input.all();\n\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d6d7add8-77b1-4083-9dbb-f4140e96dd56",
      "name": "/verify",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -672,
        416
      ],
      "webhookId": "92c5ca23-99a7-437d-85da-84aef8bd2a25",
      "parameters": {
        "path": "/verify",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "734689a3-1a5a-4e75-aeff-0cfe1906147a",
      "name": "/settle",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -672,
        608
      ],
      "webhookId": "92c5ca23-99a7-437d-85da-84aef8bd2a25",
      "parameters": {
        "path": "/settle",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "21939197-b339-42fc-94d8-2bbdb2442a0e",
      "name": "结算响应",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        896,
        224
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "={\n  \"success\": {{ $json.status === \"Success\" }},\n  \"error\": {{ JSON.stringify($json.failureReason) }},\n  \"txHash\": \"{{ $json.transactionHash }}\",\n  \"networkId\": \"{{ $json.chainId }}\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "5fa377a6-f450-497d-bec0-ad19c08bdcfc",
      "name": "验证响应",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        896,
        32
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "={\n  \"isValid\": {{ $json.success }},\n  \"invalidReason\": \"{{ $json.error.reason }}\"\n} "
      },
      "typeVersion": 1.3
    },
    {
      "id": "3a22826f-7857-4e5b-9239-a504b6a4b918",
      "name": "响应:错误的 POST 请求体 (/verify)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        448,
        752
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "{\n  \"isValid\": false,\n  \"invalidReason\": \"Incorrect or missing payload arguments\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "954e3c34-dad9-4c62-b5a6-97cff5a642dd",
      "name": "响应:错误的 POST 请求体 (/settle)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        448,
        944
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "={\n  \"success\": false,\n  \"error\": \"Missing or incorrect POST body\",\n  \"txHash\": null,\n  \"networkId\":  {{ JSON.stringify($json.body.paymentRequirements.network) }}\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "63d9fe6a-7618-429b-9e47-db9451542337",
      "name": "1Shot API 提交并等待",
      "type": "n8n-nodes-1shot.oneShotSynch",
      "position": [
        672,
        224
      ],
      "parameters": {
        "params": "={\n  \"from\": \"{{ $json.decodedXPayment.payload.authorization.from }}\",\n  \"to\": \"{{ $json.decodedXPayment.payload.authorization.to }}\",\n  \"value\": \"{{ $json.decodedXPayment.payload.authorization.value }}\",\n  \"validAfter\": \"{{ $json.decodedXPayment.payload.authorization.validAfter }}\",\n  \"validBefore\": \"{{ $json.decodedXPayment.payload.authorization.validBefore }}\",\n  \"nonce\": \"{{ $json.decodedXPayment.payload.authorization.nonce }}\",\n  \"signature\": \"{{ $json.decodedXPayment.payload.signature }}\"\n} ",
        "additionalFields": {
          "memo": "="
        },
        "contractMethodId": "={{ $json.paymentConfig.contractMethodId }}"
      },
      "credentials": {
        "oneShotOAuth2Api": {
          "id": "05rDRla9Nl1rkXlv",
          "name": "x402 Facilitator"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "019b8699-64d1-4404-9ba2-3c61a377fd8a",
      "name": "检查 POST 载荷",
      "type": "n8n-nodes-base.if",
      "position": [
        -448,
        512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2ff83590-61f3-41d8-8500-a96103c3844c",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.x402Version }}",
              "rightValue": ""
            },
            {
              "id": "a1971594-5bd9-4c77-96c3-da66c28ed23a",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.paymentHeader }}",
              "rightValue": ""
            },
            {
              "id": "506da99c-4aea-47e9-b711-6597e3eeaf75",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.paymentRequirements.network }}",
              "rightValue": ""
            },
            {
              "id": "4b11ebb0-c7cc-4c38-9d80-1dcedfa3b147",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.paymentRequirements.scheme }}",
              "rightValue": ""
            },
            {
              "id": "7cce2b0e-8525-4441-aa04-6d57ed6a8c47",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.paymentRequirements.maxAmountRequired }}",
              "rightValue": ""
            },
            {
              "id": "bd4aa27f-9ecb-4cf5-9a6a-67455cb5a309",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.paymentRequirements.resource }}",
              "rightValue": ""
            },
            {
              "id": "622b8fa7-6d14-4898-bcd0-1e0120060b9e",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.paymentRequirements.payTo }}",
              "rightValue": ""
            },
            {
              "id": "84f191fc-48e9-40f7-9629-906e0ec3db31",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.paymentRequirements.maxTimeoutSeconds }}",
              "rightValue": ""
            },
            {
              "id": "22538bd0-0f51-4994-8364-6a75c817dc7e",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.paymentRequirements.asset }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1887a18e-8f12-4f91-b7d4-ca02de6c709b",
      "name": "解码并验证 X-Payment",
      "type": "n8n-nodes-base.code",
      "onError": "continueErrorOutput",
      "position": [
        -224,
        448
      ],
      "parameters": {
        "jsCode": "try {\n    // Decode the x-payment header from base64\n    const xPaymentHeader = $input.first().json.body.paymentHeader;\n    const decodedXPayment = Buffer.from(xPaymentHeader, 'base64').toString('utf-8');\n\n    // Parse the decoded value into a JSON object\n    const decodedXPaymentJson = JSON.parse(decodedXPayment);\n\n    // Add the parsed JSON object to the input\n    $input.first().json.decodedXPayment = decodedXPaymentJson;\n\n    return $input.all();\n} catch (error) {\n    // Return an error object if the token format is invalid\n    return { error: \"invalid token format\" };\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "8255ba6a-3768-4fe6-8824-7f0f18dfbc85",
      "name": "确保支付载荷",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        304
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6666e1f6-5e99-49d4-9f9a-a5a35cde4f74",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.signature }}",
              "rightValue": ""
            },
            {
              "id": "f1e58e1f-e977-4a37-9d1d-c94ed8467787",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.from }}",
              "rightValue": ""
            },
            {
              "id": "94eb9519-6466-4c3c-a3bb-4f2eff188cc9",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.to }}",
              "rightValue": ""
            },
            {
              "id": "3c3f1f2f-e660-4259-a5c1-bc574cf4f5d7",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.value }}",
              "rightValue": ""
            },
            {
              "id": "691b9638-8932-41fb-9b1f-ab0be7db9dec",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.validAfter }}",
              "rightValue": ""
            },
            {
              "id": "04ec5919-4052-48b3-818e-a8e6544a30f9",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.validBefore }}",
              "rightValue": ""
            },
            {
              "id": "612ed984-94ff-436e-b149-d1aa75971b06",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.validBefore }}",
              "rightValue": "="
            },
            {
              "id": "5c3db8f1-8fbb-49a4-9547-fdcb3dd5b275",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.signature }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "08df85be-f602-4710-a9ca-340e39c9816b",
      "name": "/supported",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -688,
        1200
      ],
      "webhookId": "4ccebeff-20bd-4871-bb2e-f29f45d35878",
      "parameters": {
        "path": "supported",
        "options": {},
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "5b19047c-d340-4cfc-9909-b7589b999a32",
      "name": "响应:返回支持的网络",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -64,
        1184
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "={\n  \"kinds\": {{ JSON.stringify($json.kinds) }}\n} "
      },
      "typeVersion": 1.3
    },
    {
      "id": "ac002b7a-108e-49b6-bed7-16bb8477fe6e",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        16
      ],
      "parameters": {
        "width": 448,
        "height": 416,
        "content": "## /verify 端点"
      },
      "typeVersion": 1
    },
    {
      "id": "cea02913-92b7-45aa-bcb2-1e3dc3a8d588",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        528
      ],
      "parameters": {
        "width": 432,
        "height": 464,
        "content": "## /settle 端点"
      },
      "typeVersion": 1
    },
    {
      "id": "9cd414aa-fa67-4c9c-8177-6a3568d43af2",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -16
      ],
      "parameters": {
        "width": 320,
        "height": 240,
        "content": "## 接受的代币配置"
      },
      "typeVersion": 1
    },
    {
      "id": "e788d782-8540-437e-b86f-a3d14c75b885",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1152,
        1152
      ],
      "parameters": {
        "width": 416,
        "height": 320,
        "content": "## /supported 端点"
      },
      "typeVersion": 1
    },
    {
      "id": "64f5beea-0952-4aca-9c07-3ec3eef523d8",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        1440
      ],
      "parameters": {
        "width": 384,
        "height": 176,
        "content": "## 支持的网络配置"
      },
      "typeVersion": 1
    },
    {
      "id": "c6292c7a-cac1-46be-a61c-b80170aa1a93",
      "name": "支持的网络配置",
      "type": "n8n-nodes-base.code",
      "onError": "continueErrorOutput",
      "position": [
        -400,
        1200
      ],
      "parameters": {
        "jsCode": "const input = $input.all()\n\n\nconst kinds = [\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"base-mainnet\",\n    },\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"base-sepolia\",\n    },\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"avalanche\",\n    },\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"avalanche-fuji\",\n    },\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"arbitrum-mainnet\",\n    },\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"ethereum-mainnet\",\n    }\n  ]\n\n$input.first().json.kinds = kinds;\n\nreturn $input.all();\n"
      },
      "typeVersion": 2
    },
    {
      "id": "9fb18099-c840-47af-b8d6-9f8107c05dd3",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2000,
        400
      ],
      "parameters": {
        "width": 688,
        "height": 544,
        "content": "## 示例协调器 Curl 请求"
      },
      "typeVersion": 1
    },
    {
      "id": "7c69392c-d424-4639-909e-588a5f17cee2",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -240
      ],
      "parameters": {
        "width": 432,
        "height": 224,
        "content": "## 创建您的 1Shot API 凭据"
      },
      "typeVersion": 1
    },
    {
      "id": "c94b228a-7a92-45b9-9ded-fb34186eaa2e",
      "name": "错误的载荷或标头",
      "type": "n8n-nodes-base.if",
      "position": [
        224,
        784
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "185b904e-d8c8-4605-9075-531abc762b46",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.webhookUrl }}",
              "rightValue": "verify"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "efa373f0-b6ae-4a46-b6f2-ec6f6d2eae67",
      "name": "不支持的代币",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "185b904e-d8c8-4605-9075-531abc762b46",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.webhookUrl }}",
              "rightValue": "verify"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c7ab50fa-af33-41ec-849f-a53f7ec7b54d",
      "name": "verify 或 settle",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "185b904e-d8c8-4605-9075-531abc762b46",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.webhookUrl }}",
              "rightValue": "verify"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b80d7ac0-14bc-4dfb-936b-a09c3644ba53",
      "name": "响应:不支持的代币 (/verify)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        672,
        416
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "{\n  \"isValid\": false,\n  \"invalidReason\": \"Unsupported payment token\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "f57b3f31-2f63-482a-87d7-cdeb8884f0de",
      "name": "响应:不支持的代币 (/settle)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        672,
        608
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "={\n  \"success\": false,\n  \"error\": \"Unsupported payment token\",\n  \"txHash\": null,\n  \"networkId\": {{ JSON.stringify(($json.error.match(/<([^>]+)>/) || [])[1] || null) }}\n} "
      },
      "typeVersion": 1.3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "60b6cf16-d04b-4402-ac83-a827312a8edf",
  "connections": {
    "/settle": {
      "main": [
        [
          {
            "node": "Check POST Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "/verify": {
      "main": [
        [
          {
            "node": "Check POST Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "/supported": {
      "main": [
        [
          {
            "node": "Supported Networks Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simulate Payment": {
      "main": [
        [
          {
            "node": "Verify Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "verify or settle": {
      "main": [
        [
          {
            "node": "Simulate Payment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "1Shot API Submit & Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unsupported Token": {
      "main": [
        [
          {
            "node": "Response: Unsupported Token (/verify)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: Unsupported Token (/settle)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check POST Payload": {
      "main": [
        [
          {
            "node": "Decode & Validate X-Payment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Bad Payload or Header",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bad Payload or Header": {
      "main": [
        [
          {
            "node": "Response: Bad POST Body (/verify)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: Bad POST Body (/settle)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ensure Payment Payload": {
      "main": [
        [
          {
            "node": "Lookup Payment Configs",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Bad Payload or Header",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lookup Payment Configs": {
      "main": [
        [
          {
            "node": "verify or settle",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Unsupported Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1Shot API Submit & Wait": {
      "main": [
        [
          {
            "node": "Settlement Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Settlement Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supported Networks Config": {
      "main": [
        [
          {
            "node": "Response: Return Supported Networks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decode & Validate X-Payment": {
      "main": [
        [
          {
            "node": "Ensure Payment Payload",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Bad Payload or Header",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 加密货币交易, 多模态 AI

需要付费吗?

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

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

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

作者
1Shot API

1Shot API

@oneshotapi

1Shot API lets you bring onchain actions into your n8n workflows.

外部链接
在 n8n.io 查看

分享此工作流