{
  "name": "Payment processing and order tracking with YooKassa and Google Sheets",
  "nodes": [
    {
      "id": "0ccb2fd9-139a-4234-9e2b-feabf63563c5",
      "name": "Respond Products",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        560,
        40
      ]
    },
    {
      "id": "cabb25e6-9683-4a4f-9832-7a7630a011bf",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        -40
      ],
      "parameters": {
        "width": 1040,
        "height": 400,
        "content": "# Get Products"
      }
    },
    {
      "id": "88b5245c-bce9-44e7-beb7-172137d63d61",
      "name": "Get products",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -120,
        80
      ]
    },
    {
      "id": "5a218b21-d7a7-4f4f-9883-6db1a994513b",
      "name": "Sorting  by price",
      "type": "n8n-nodes-base.sort",
      "position": [
        340,
        40
      ]
    },
    {
      "id": "d3265cbe-dc41-49ee-9cdd-d265efefaa0c",
      "name": "Handle Error (get product)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        560,
        200
      ]
    },
    {
      "id": "14fad20c-566a-4ce3-a4c3-a28922f2ceb1",
      "name": "Get Product",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        680,
        500
      ]
    },
    {
      "id": "5b619423-3a66-4ea8-bdc4-da49c5c55295",
      "name": "YooKassa Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1280,
        500
      ]
    },
    {
      "id": "a56d477f-af9b-40a1-ba6c-5d28d11b4f8d",
      "name": "Save Order",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1480,
        500
      ]
    },
    {
      "id": "241307e3-9536-404c-aa27-6e21bb5424c0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        400
      ],
      "parameters": {
        "width": 2140,
        "height": 480,
        "content": "# Payment"
      }
    },
    {
      "id": "830a9d53-1e6a-4293-8440-7aa73edbd2f8",
      "name": "Payment",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -120,
        600
      ]
    },
    {
      "id": "7dedf78b-414f-421f-97af-6e5ab87fdec4",
      "name": "Check request values",
      "type": "n8n-nodes-base.if",
      "position": [
        80,
        600
      ]
    },
    {
      "id": "84c0764f-6496-4047-bd34-593b722560f1",
      "name": "Email validation",
      "type": "n8n-nodes-base.if",
      "position": [
        280,
        520
      ]
    },
    {
      "id": "9090fbcf-96c9-4f53-b13a-0fa471435052",
      "name": "Get product_id",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        500
      ]
    },
    {
      "id": "ad49466c-6ad4-411c-9c67-8a3e066d5359",
      "name": "Check product_id",
      "type": "n8n-nodes-base.if",
      "position": [
        880,
        500
      ]
    },
    {
      "id": "b1bca082-6fbe-42e8-9602-4a31c86a82c6",
      "name": "Handle Error (product_id)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1080,
        680
      ]
    },
    {
      "id": "913b424e-fceb-4435-820b-59efe11083a3",
      "name": "Idempotence Key Generation",
      "type": "n8n-nodes-base.code",
      "position": [
        1080,
        500
      ]
    },
    {
      "id": "f5bc3ad6-8599-4ed1-a501-bc2c1507fa73",
      "name": "Handle Error",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        480,
        680
      ]
    },
    {
      "id": "4b6d62b9-3ac3-4cc8-944a-64372a8aaa80",
      "name": "Handle Error (yookassa)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1480,
        680
      ]
    },
    {
      "id": "12568776-4885-46ac-a831-35d56207bb95",
      "name": "Handle Error (save order)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1700,
        680
      ]
    },
    {
      "id": "d1032cdb-c456-45b0-a534-14ed920228b6",
      "name": "Respond Payment",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1700,
        500
      ]
    },
    {
      "id": "52b428e6-521c-4b22-b41e-ed96971f5ecf",
      "name": "Handle Error (get product)_1",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        880,
        680
      ]
    },
    {
      "id": "46193f6f-577b-4872-a11c-22b7e2f1ff61",
      "name": "Get Order",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        480,
        1000
      ]
    },
    {
      "id": "d5abfe86-2462-4299-a84f-18006879ba81",
      "name": "Save Transaction",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        880,
        1000
      ]
    },
    {
      "id": "081a8ec1-01ba-4ce6-811d-d527060e73f6",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        920
      ],
      "parameters": {
        "width": 1520,
        "height": 620,
        "content": "# Webhook"
      }
    },
    {
      "id": "4c7ad01d-314e-463a-b499-e05a4628f8d9",
      "name": "Handle Events",
      "type": "n8n-nodes-base.switch",
      "position": [
        80,
        1180
      ]
    },
    {
      "id": "5eb6b856-c62b-4781-a7cd-728f9e43b0aa",
      "name": "Validation metadata",
      "type": "n8n-nodes-base.if",
      "position": [
        280,
        1000
      ]
    },
    {
      "id": "e0670c19-ac44-4d10-ae8f-8f324f209b0c",
      "name": "Check Order",
      "type": "n8n-nodes-base.if",
      "position": [
        680,
        1000
      ]
    },
    {
      "id": "f5436549-a2c8-4b1c-bc09-1a7902afe8be",
      "name": "Validation metadata_",
      "type": "n8n-nodes-base.if",
      "position": [
        280,
        1360
      ]
    },
    {
      "id": "e2f00535-bf29-43b5-9eac-a8e5ee6c3ab9",
      "name": "Get transaction",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        480,
        1360
      ]
    },
    {
      "id": "24016b43-795b-4c7b-ad9b-9d9d220cdeef",
      "name": "Respond payment event",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1080,
        1000
      ]
    },
    {
      "id": "64aa9833-522e-41b0-bb78-454d1122eb71",
      "name": "Respond refund event",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1080,
        1360
      ]
    },
    {
      "id": "984ac85d-5cae-4b57-8ce7-c61c6a12ceef",
      "name": "Handle Error webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        880,
        1180
      ]
    },
    {
      "id": "cf3937fa-e0ee-4d5c-b9b9-4a575f895122",
      "name": "Status",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -120,
        1720
      ]
    },
    {
      "id": "100e8560-78b2-40a8-ac20-82f8bb16138e",
      "name": "Handle Error status",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        480,
        1900
      ]
    },
    {
      "id": "e943aec6-962f-444d-811c-7975e12fad20",
      "name": "Handle Error (check request)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        280,
        1900
      ]
    },
    {
      "id": "eb076097-abc8-46b3-b983-31918d96e284",
      "name": "Check request values_1",
      "type": "n8n-nodes-base.if",
      "position": [
        80,
        1720
      ]
    },
    {
      "id": "4d1b91e0-0b28-4fea-a5ad-ee10a2f7c238",
      "name": "YooKassa Request Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        280,
        1720
      ]
    },
    {
      "id": "bf520270-5b44-48f7-a891-cf1394df64ad",
      "name": "Respond status",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        480,
        1720
      ]
    },
    {
      "id": "b0f5195c-ffb7-4af6-8fbf-04eeeca5eafd",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        1580
      ],
      "parameters": {
        "width": 960,
        "height": 500,
        "content": "# Status"
      }
    },
    {
      "id": "b3821373-2948-412e-b9e5-f52c5c707512",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -920,
        -40
      ],
      "parameters": {
        "width": 700,
        "height": 2460,
        "content": "# Accept YooKassa payments and log transactions in Google Sheets\n\n## 🧾 Summary\n\nThis workflow allows you to accept online payments via **YooKassa** and log both orders and transactions in **Google She"
      }
    },
    {
      "id": "966a7de7-af56-4780-afba-e55f1ac10375",
      "name": "Get products_1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        100,
        80
      ]
    },
    {
      "id": "f26e5f4f-39f8-4345-b2b3-bbae0740c9a7",
      "name": "Handle YooKassa webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -120,
        1180
      ]
    },
    {
      "id": "d7c1eebc-3a26-49bf-ac98-ebe60a8127ca",
      "name": "Update refund status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        880,
        1360
      ]
    },
    {
      "id": "2bf0aa18-1542-44d8-a198-7b0e024a1717",
      "name": "Check if transaction exists",
      "type": "n8n-nodes-base.if",
      "position": [
        680,
        1360
      ]
    }
  ],
  "connections": {
    "Status": {
      "main": [
        [
          {
            "node": "Check request values_1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Payment": {
      "main": [
        [
          {
            "node": "Check request values",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Order": {
      "main": [
        [
          {
            "node": "Check Order",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Order": {
      "main": [
        [
          {
            "node": "Respond Payment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error (save order)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Order": {
      "main": [
        [
          {
            "node": "Save Transaction",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Product": {
      "main": [
        [
          {
            "node": "Check product_id",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error (get product)_1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get products": {
      "main": [
        [
          {
            "node": "Get products_1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Handle Events": {
      "main": [
        [
          {
            "node": "Validation metadata",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Validation metadata_",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get product_id": {
      "main": [
        [
          {
            "node": "Get Product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get products_1": {
      "main": [
        [
          {
            "node": "Sorting  by price",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error (get product)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get transaction": {
      "main": [
        [
          {
            "node": "Check if transaction exists",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check product_id": {
      "main": [
        [
          {
            "node": "Idempotence Key Generation",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error (product_id)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email validation": {
      "main": [
        [
          {
            "node": "Get product_id",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Transaction": {
      "main": [
        [
          {
            "node": "Respond payment event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "YooKassa Request": {
      "main": [
        [
          {
            "node": "Save Order",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error (yookassa)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sorting  by price": {
      "main": [
        [
          {
            "node": "Respond Products",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validation metadata": {
      "main": [
        [
          {
            "node": "Get Order",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check request values": {
      "main": [
        [
          {
            "node": "Email validation",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update refund status": {
      "main": [
        [
          {
            "node": "Respond refund event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validation metadata_": {
      "main": [
        [
          {
            "node": "Get transaction",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check request values_1": {
      "main": [
        [
          {
            "node": "YooKassa Request Status",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error (check request)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Handle YooKassa webhook": {
      "main": [
        [
          {
            "node": "Handle Events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "YooKassa Request Status": {
      "main": [
        [
          {
            "node": "Respond status",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Idempotence Key Generation": {
      "main": [
        [
          {
            "node": "YooKassa Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if transaction exists": {
      "main": [
        [
          {
            "node": "Update refund status",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Error webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}