{
  "name": "Review technical SEO findings for a client report with a buyer-approved Website Check",
  "nodes": [
    {
      "parameters": {
        "content": "### How it works\nUse this manual workflow when an SEO report flags a change and a reviewer needs page-level evidence. A buyer can authorize one Website Check for €9.90. A private table saves the order key before Checkout. Returning to the same reference retrieves the original order. The final node returns the affected URL, observed evidence, and suggested action when available.\n\n### Setup\nStart in **mock** mode. In your private n8n project create `PriorivoMockOrders` with five string columns: `orderReference`, `websiteUrl`, `locale`, `privateOrderKey`, `orderId`. In **Set buyer inputs** set a unique reference, `intent=create` and `buyerApproved=true` to simulate consent. Run again with `intent=resume`, the same URL, reference and locale, and `mockOutcome=complete`. Mock runs make no network requests.\n\nBefore your first run, open workflow Settings: set successful, failed and manual execution histories to **Do not save**, disable execution-progress saving, keep **Available in MCP** off, and follow https://getpriorivo.com/developers/agents/#n8n-starter (imports can reset these settings).\n\nFor an authorized purchase, use a separate restricted `PriorivoPrivateOrders` table with the same columns and select `live`. Confirm the buyer controls the site and accepts €9.90 before create or retry. Give only that buyer the private Stripe link. Run one execution at a time per reference. Keep keys, links and results inside the buyer's project.",
        "color": 1,
        "width": 550,
        "height": 720
      },
      "id": "2abb153b-46b7-4d88-9273-d827662383d8",
      "name": "Set up a resumable website check",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -650,
        -300
      ]
    },
    {
      "id": "e462b143-604a-451f-9ccb-000000000008",
      "name": "Set scope",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        -105
      ],
      "parameters": {
        "color": 7,
        "width": 655,
        "height": 455,
        "content": "## Choose the site and buyer intent\nKeep the URL, locale and reference the same for the full order."
      }
    },
    {
      "id": "e462b143-604a-451f-9ccb-000000000009",
      "name": "Recover the order",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        625,
        -105
      ],
      "parameters": {
        "color": 7,
        "width": 670,
        "height": 455,
        "content": "## Recover the original order\nLook up its private key before choosing a route."
      }
    },
    {
      "id": "e462b143-604a-451f-9ccb-000000000010",
      "name": "Persist before Checkout",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1300,
        -245
      ],
      "parameters": {
        "color": 7,
        "width": 675,
        "height": 430,
        "content": "## Save before requesting Checkout\nAn interruption here can be recovered with an approved retry."
      }
    },
    {
      "id": "e462b143-604a-451f-9ccb-000000000011",
      "name": "Exercise the buyer journey",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1990,
        -135
      ],
      "parameters": {
        "color": 7,
        "width": 475,
        "height": 750,
        "content": "## Choose mock or live\nMock responses stay inside this workflow. Live sends one request to Priorivo."
      }
    },
    {
      "id": "e462b143-604a-451f-9ccb-000000000012",
      "name": "Review evidence",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2500,
        -130
      ],
      "parameters": {
        "color": 7,
        "width": 920,
        "height": 670,
        "content": "## Interpret the result\nSave the first acknowledgement, then return a private report or a next step."
      }
    },
    {
      "parameters": {},
      "id": "3a0ee819-4a75-4d31-b997-39c68ae6c254",
      "name": "Start manually",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        140
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "816416a8-6bc3-4530-aecf-afdf15fd7322",
              "name": "websiteUrl",
              "type": "string",
              "value": "https://example.com/"
            },
            {
              "id": "b10f9321-2204-428d-a942-a15d02c8aec0",
              "name": "locale",
              "type": "string",
              "value": "en-US"
            },
            {
              "id": "c9d0a5db-701c-45b8-bf25-40d7152e7083",
              "name": "orderReference",
              "type": "string",
              "value": "CHANGE-ME-UNIQUE-REFERENCE"
            },
            {
              "id": "65e199e7-04ae-4b11-8820-37f05dae00f4",
              "name": "intent",
              "type": "string",
              "value": "resume"
            },
            {
              "id": "dadeb260-8643-469a-83b0-c45b13a0fbb2",
              "name": "buyerApproved",
              "type": "boolean",
              "value": false
            },
            {
              "id": "e462b143-604a-451f-9ccb-000000000001",
              "name": "environment",
              "type": "string",
              "value": "mock"
            },
            {
              "id": "e462b143-604a-451f-9ccb-000000000002",
              "name": "mockOutcome",
              "type": "string",
              "value": "payment_pending"
            }
          ]
        },
        "options": {}
      },
      "id": "ffcf4295-c1ea-4a06-9b6c-831c2361d9e8",
      "name": "Set buyer inputs",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        210,
        140
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const x = $input.first().json;\nconst ref = typeof x.orderReference === 'string' ? x.orderReference.trim() : '';\nif (!/^[A-Za-z0-9_-]{12,80}$/.test(ref) || /^CHANGE-ME/i.test(ref))\n  throw new Error('STOP: set a stable private orderReference (12-80 chars) before any attempt.');\nif (typeof x.websiteUrl !== 'string' || x.websiteUrl.length > 2048 || !/^https:\\/\\/[^\\s/?#]+/.test(x.websiteUrl) || /https:\\/\\/[^\\s/]*@/.test(x.websiteUrl))\n  throw new Error('STOP: use one approved public HTTPS website URL without credentials.');\nconst hostMatch = /^https:\\/\\/([a-z0-9.-]+)(?::[0-9]{1,5})?(?:[/?#]|$)/i.exec(x.websiteUrl);\nif (!hostMatch || !hostMatch[1].includes('.') || x.websiteUrl.includes('\\\\') || /\\s/.test(x.websiteUrl))\n  throw new Error('STOP: use a public HTTPS domain without credentials.');\nconst h = hostMatch[1].toLowerCase().replace(/\\.$/, '');\nif (h === 'localhost' || h.endsWith('.local') || h.endsWith('.internal') || /^(127\\.|10\\.|192\\.168\\.|169\\.254\\.|0\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/.test(h))\n  throw new Error('STOP: private/internal host is not an eligible public website.');\nif (!['en-US','sk-SK'].includes(x.locale))\n  throw new Error('STOP: paid agent results currently support only en-US and sk-SK.');\nif (!['create','resume','retry_checkout'].includes(x.intent))\n  throw new Error('STOP: intent must be create, resume or retry_checkout.');\nif (!['mock','live'].includes(x.environment)) throw new Error('Select mock or live explicitly.');\nconst stages = ['payment_pending','interrupt','processing','complete','refunded','unavailable'];\nif (x.environment === 'mock' && !stages.includes(x.mockOutcome)) throw new Error('Unknown mock outcome.');\n// No entitlement or payment is inferred here; an operator must confirm permission for purchase.\nreturn [{json:{websiteUrl:x.websiteUrl,locale:x.locale,orderReference:ref,intent:x.intent,buyerApproved:x.buyerApproved===true,environment:x.environment,mockOutcome:x.mockOutcome}}];"
      },
      "id": "6d334bc1-0a85-4457-8f50-b1bc6228d347",
      "name": "Validate public URL and stable reference",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        420,
        140
      ]
    },
    {
      "parameters": {
        "resource": "row",
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "value": "={{ $('Validate public URL and stable reference').first().json.environment === 'mock' ? 'PriorivoMockOrders' : 'PriorivoPrivateOrders' }}",
          "mode": "name"
        },
        "matchType": "allConditions",
        "filters": {
          "conditions": [
            {
              "keyName": "orderReference",
              "condition": "eq",
              "keyValue": "={{ $(\"Validate public URL and stable reference\").first().json.orderReference }}"
            }
          ]
        },
        "returnAll": false,
        "limit": 2
      },
      "id": "748b989e-c6d7-4d8f-b010-08904f875205",
      "name": "Find existing private order in Data Table",
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1,
      "position": [
        670,
        140
      ],
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const cfg = $('Validate public URL and stable reference').first().json;\nconst matches = $input.all().map(i => i.json).filter(x => Object.keys(x).length > 0);\nif (matches.length > 1) throw new Error('STOP: duplicate orderReference rows; resolve private ledger inconsistency first.');\nconst prior = matches[0];\nif (cfg.intent === 'create') {\n  if (prior) throw new Error('STOP: this reference already exists. Select resume or retry_checkout; never create a second order.');\n  if (!cfg.buyerApproved) throw new Error('STOP: buyer must explicitly approve one EUR 9.90 checkout before creating order.');\n  if (cfg.environment === 'live' && cfg.websiteUrl === 'https://example.com/') throw new Error('STOP: replace the placeholder with an authorized public website URL.');\n  return [{json:{...cfg,route:'create'}}];\n}\nif (!prior) throw new Error('STOP: no saved order. Cannot resume or retry without the original private key; never create a substitute order.');\nif (prior.orderReference !== cfg.orderReference || prior.websiteUrl !== cfg.websiteUrl || prior.locale !== cfg.locale)\n  throw new Error('STOP: existing order body/reference differs. Use exact original URL and locale.');\nif (!/^[A-Za-z0-9_-]{32,80}$/.test(prior.privateOrderKey))\n  throw new Error('STOP: stored private order key is invalid; no request was sent.');\nif (prior.orderId && !/^pao_[a-f0-9]{32}$/.test(prior.orderId)) throw new Error('STOP: invalid stored provider order ID.');\nif (cfg.intent === 'resume' && !/^pao_[a-f0-9]{32}$/.test(prior.orderId || ''))\n  throw new Error('STOP: first Checkout response was not recorded. With buyer approval, use retry_checkout and the original reference.');\nif (cfg.intent === 'retry_checkout' && !cfg.buyerApproved)\n  throw new Error('STOP: buyer approval required to request the original Checkout again, even with the same key.');\nreturn [{json:{...cfg,privateOrderKey:prior.privateOrderKey,orderId:prior.orderId || '',route:cfg.intent}}];"
      },
      "id": "0d75dd5f-a321-4085-882f-9aa4568ed0a2",
      "name": "Recover the original order key",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        890,
        140
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "4aa77b87-845d-4e0b-b983-cafdb810214b",
              "leftValue": "={{ $json.route }}",
              "rightValue": "create",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "8969039f-abc3-4829-ae54-74f9f18ef551",
      "name": "Create a new order?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1120,
        140
      ]
    },
    {
      "parameters": {
        "action": "generate",
        "dataPropertyName": "privateOrderKey",
        "encodingType": "hex",
        "stringLength": 64
      },
      "id": "f7b4e21d-7fd6-42e4-a8f8-e54eaf66530d",
      "name": "Generate a private order key",
      "type": "n8n-nodes-base.crypto",
      "typeVersion": 1,
      "position": [
        1340,
        -20
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const cfg = $('Recover the original order key').first().json;\nconst k = $input.first().json.privateOrderKey;\nif (cfg.route !== 'create' || cfg.buyerApproved !== true || !/^[a-f0-9]{64}$/.test(k))\n  throw new Error('STOP: a fresh authorized order requires 64 hex characters from Crypto V1.');\n// Persist the private capability BEFORE the first Checkout POST.\n// This table is a restricted secret-bearing resource; do not share execution data.\nreturn [{json:{orderReference:cfg.orderReference,websiteUrl:cfg.websiteUrl,locale:cfg.locale,privateOrderKey:k,orderId:''}}];"
      },
      "id": "2439c4b5-f21c-4c65-a3b5-b06ab3bc143f",
      "name": "Prepare the private order row",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1570,
        -20
      ]
    },
    {
      "parameters": {
        "resource": "row",
        "operation": "insert",
        "dataTableId": {
          "__rl": true,
          "value": "={{ $('Validate public URL and stable reference').first().json.environment === 'mock' ? 'PriorivoMockOrders' : 'PriorivoPrivateOrders' }}",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {}
        }
      },
      "id": "54b68fa6-58b7-4adb-b261-a20a745d63df",
      "name": "Persist new key in restricted Data Table",
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1,
      "position": [
        1790,
        -20
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Idempotency-Key",
              "value": "={{ $json.privateOrderKey }}"
            }
          ]
        },
        "sendBody": true,
        "contentType": "json",
        "specifyBody": "json",
        "options": {
          "timeout": 20000,
          "response": {
            "response": {
              "fullResponse": true,
              "neverError": true,
              "responseFormat": "json"
            }
          },
          "redirect": {
            "redirect": {
              "followRedirects": false
            }
          }
        },
        "url": "https://getpriorivo.com/api/agent/v1/website-check/checkout",
        "jsonBody": "={{ JSON.stringify({url: $json.websiteUrl, locale: $json.locale}) }}"
      },
      "id": "e4261952-c75d-4e6d-9d29-a9603aa6b8d7",
      "name": "Request or resume the original Checkout",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        2290,
        420
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "e43d2201-a4d2-4ed1-ad68-ecf157d79953",
              "leftValue": "={{ $('Validate public URL and stable reference').first().json.environment }}",
              "rightValue": "mock",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "625a6758-fe44-4aaa-8242-f858d3957412",
      "name": "Use the offline example?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        2050,
        180
      ]
    },
    {
      "id": "e462b143-604a-451f-9ccb-000000000003",
      "name": "Simulate the provider response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const cfg = $('Validate public URL and stable reference').first().json;\nif (cfg.environment !== 'mock') throw new Error('Mock branch requires mock mode.');\nconst state = cfg.mockOutcome;\nif (state === 'interrupt') throw new Error('Simulated lost response after key persistence. Retry the same reference.');\nif (state === 'unavailable') return [{json:{statusCode:503,headers:{'retry-after':'30'},body:{error:'mock_unavailable'}}}];\nconst order = {order_id:'pao_00000000000000000000000000000000',state,amount_minor:990,currency:'eur',reconcile_required:false};\nif (state === 'complete') order.result = {contract:'website-check-v1',source_content_untrusted:true,analysis:{\n  target:'https://example.com/',status:'complete',checked:{wide_page_count:1,deep_page_count:1,render_count:2},\n  findings:[{code:'indexability_noindex',kind:'review',severity:'medium',page_url:'https://example.com/reports/',\n    title:'Check the indexing intent',evidence:{meta:true,header:false},why:'A noindex directive may keep this page out of search results.',\n    recommendation:'Confirm whether the page is intended for search before changing the directive.'}],\n  priority:{primary:{status:'review',importance:'medium'}}\n},decision_handoff:{\n  schema_version:'priorivo-decision-handoff-v1',state:'ready_for_human_review',\n  source_url:'https://example.com/reports/',finding_code:'indexability_noindex',\n  importance:'medium',evidence:{meta:true,header:false},\n  why:'A noindex directive may keep this page out of search results.',\n  next_step:'Confirm whether the page is intended for search before changing the directive.',\n  requires_human_review:true,website_modified:false,\n  google_indexation_verified:false,source_content_untrusted:true\n}};\nreturn [{json:{statusCode:['complete','refunded'].includes(state)?200:202,body:{ok:true,order}}}];"
      },
      "position": [
        2290,
        90
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const response = $input.first().json;\nconst cfg = $('Validate public URL and stable reference').first().json;\nconst saved = $('Recover the original order key').first().json;\nconst http = Number(response.statusCode);\nconst order = response.body?.order || {};\nconst orderId = /^pao_[a-f0-9]{32}$/.test(order.order_id || '') ? order.order_id : null;\nif (saved.orderId && orderId && saved.orderId !== orderId) throw new Error('Order ID changed. Stop and reconcile the original order.');\nconst validOrder = orderId && order.amount_minor === 990 && order.currency === 'eur';\nconst state = order.state || null;\nconst result = {mode:cfg.environment,statusCode:http,resultState:state,privateResultReady:false};\nconst analysis = order.result?.analysis;\nif (validOrder && http === 200 && state === 'complete' && analysis && typeof analysis === 'object' && !Array.isArray(analysis) && Object.keys(analysis).length > 0 && (!order.result.contract || order.result.contract === 'website-check-v1') && (!analysis.status || analysis.status === 'complete') && (analysis.findings === undefined || Array.isArray(analysis.findings))) {\n  result.privateResultReady = true;\n  result.checked = analysis.checked ?? null;\n  result.findings = analysis.findings?.map(({code,title,page_url,affected_urls,severity,kind,evidence,why,recommendation}) =>\n    ({code,title,page_url,affected_urls,severity,kind,evidence,why,recommendation})) ?? null;\n  result.priority = analysis.priority ?? null;\n  // The paid handoff lives beside analysis in the private order result, not inside analysis.\n  // Copy only documented fields; never forward privateOrderKey, checkout_url or raw order fields.\n  // A complete scan can legitimately report insufficient_evidence: this is NOT a recommendation.\n  const handoff = order.result?.decision_handoff;\n  result.decision_handoff = null; // Legacy paid records may predate this contract.\n  if (handoff && typeof handoff === 'object' && !Array.isArray(handoff)\n      && handoff.schema_version === 'priorivo-decision-handoff-v1'\n      && ['ready_for_human_review', 'insufficient_evidence'].includes(handoff.state)\n      && handoff.requires_human_review === true\n      && handoff.website_modified === false\n      && handoff.google_indexation_verified === false\n      && handoff.source_content_untrusted === true) {\n    const base = {\n      schema_version: 'priorivo-decision-handoff-v1',\n      state: handoff.state,\n      source_url: null, finding_code: null, importance: null,\n      evidence: null, why: null, next_step: null,\n      requires_human_review: true, website_modified: false,\n      google_indexation_verified: false, source_content_untrusted: true\n    };\n    if (handoff.state === 'insufficient_evidence') {\n      result.decision_handoff = base;\n    } else if (typeof handoff.source_url === 'string'\n        && /^https:\\/\\/[^\\s/@]+/.test(handoff.source_url)\n        && typeof handoff.finding_code === 'string' && handoff.finding_code.length > 0\n        && handoff.evidence && typeof handoff.evidence === 'object'\n        && Object.keys(handoff.evidence).length > 0\n        && typeof handoff.why === 'string' && handoff.why.trim().length > 0\n        && typeof handoff.next_step === 'string' && handoff.next_step.trim().length > 0) {\n      result.decision_handoff = {\n        ...base, source_url: handoff.source_url, finding_code: handoff.finding_code,\n        importance: typeof handoff.importance === 'string' ? handoff.importance : null,\n        evidence: handoff.evidence, why: handoff.why, next_step: handoff.next_step\n      };\n    }\n  }\n  result.message = result.decision_handoff?.state === 'ready_for_human_review'\n    ? 'Review the evidence-backed next step with a human before adding it to the client report.'\n    : result.decision_handoff?.state === 'insufficient_evidence'\n      ? 'The paid result is complete but does not justify an action. Human review required; do not invent a next step.'\n      : 'The result is complete but contains no validated decision handoff (legacy or malformed result). Review findings manually; do not invent an action.';\n} else if (validOrder && http === 200 && state === 'refunded') {\n  result.message = 'Refunded. Stop this order.';\n} else if (validOrder && http === 202 && state === 'payment_pending') {\n  result.message = cfg.environment === 'mock' ? 'Simulated buyer decision. No payment link is generated.' : 'Buyer decision pending. Only the buyer may approve EUR 9.90 in Stripe.';\n  if (cfg.environment === 'live' && !order.checkout_url) result.message = 'Waiting for payment. Resume with the same reference; do not open another order.';\n  if (cfg.environment === 'live' && /^https:\\/\\/checkout\\.stripe\\.com(?:\\/|$)/.test(order.checkout_url || '')) result.checkoutUrl = order.checkout_url;\n} else if (validOrder && http === 202 && ['paid','processing'].includes(state)) {\n  result.message = 'Processing. Resume later with the same inputs and order key.';\n} else {\n  result.message = http === 410 ? 'Expired. Stop this order.' : 'Inspect the private response and resolve the error before retrying the original order.';\n}\nconst retryAfter = response.headers?.['retry-after'] ?? response.headers?.['Retry-After'];\nif (retryAfter != null) result.retryAfter = String(retryAfter);\nconst recordId = validOrder && !saved.orderId && ((http === 202 && ['payment_pending','paid','processing'].includes(state)) || (http === 200 && ['complete','refunded'].includes(state)));\nreturn [{json:{...result,recordId:recordId ? orderId : ''}}];"
      },
      "id": "aad44194-e5a8-4c34-a633-f5d78f033afe",
      "name": "Interpret the private response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2540,
        220
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "e462b143-604a-451f-9ccb-000000000005",
              "leftValue": "={{ $json.recordId }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "e462b143-604a-451f-9ccb-000000000004",
      "name": "First order response?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        2770,
        220
      ]
    },
    {
      "parameters": {
        "resource": "row",
        "operation": "update",
        "dataTableId": {
          "__rl": true,
          "value": "={{ $('Validate public URL and stable reference').first().json.environment === 'mock' ? 'PriorivoMockOrders' : 'PriorivoPrivateOrders' }}",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "orderId": "={{ $json.recordId }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "orderId",
              "displayName": "orderId",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            }
          ]
        },
        "matchType": "allConditions",
        "filters": {
          "conditions": [
            {
              "keyName": "orderReference",
              "condition": "eq",
              "keyValue": "={{ $(\"Validate public URL and stable reference\").first().json.orderReference }}"
            }
          ]
        }
      },
      "id": "e462b143-604a-451f-9ccb-000000000006",
      "name": "Record the provider order ID",
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1,
      "position": [
        3000,
        100
      ],
      "alwaysOutputData": true
    },
    {
      "id": "e462b143-604a-451f-9ccb-000000000007",
      "name": "Return private evidence or next step",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const {recordId, ...result} = $('Interpret the private response').first().json;\nif (recordId && $input.first().json.orderId !== recordId) throw new Error('The order acknowledgement was not saved. Reconcile the existing private row before continuing.');\nreturn [{json:result}];"
      },
      "position": [
        3230,
        280
      ]
    }
  ],
  "connections": {
    "Start manually": {
      "main": [
        [
          {
            "node": "Set buyer inputs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set buyer inputs": {
      "main": [
        [
          {
            "node": "Validate public URL and stable reference",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate public URL and stable reference": {
      "main": [
        [
          {
            "node": "Find existing private order in Data Table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find existing private order in Data Table": {
      "main": [
        [
          {
            "node": "Recover the original order key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recover the original order key": {
      "main": [
        [
          {
            "node": "Create a new order?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a new order?": {
      "main": [
        [
          {
            "node": "Generate a private order key",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Use the offline example?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate a private order key": {
      "main": [
        [
          {
            "node": "Prepare the private order row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare the private order row": {
      "main": [
        [
          {
            "node": "Persist new key in restricted Data Table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Persist new key in restricted Data Table": {
      "main": [
        [
          {
            "node": "Use the offline example?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Use the offline example?": {
      "main": [
        [
          {
            "node": "Simulate the provider response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Request or resume the original Checkout",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simulate the provider response": {
      "main": [
        [
          {
            "node": "Interpret the private response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request or resume the original Checkout": {
      "main": [
        [
          {
            "node": "Interpret the private response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Interpret the private response": {
      "main": [
        [
          {
            "node": "First order response?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "First order response?": {
      "main": [
        [
          {
            "node": "Record the provider order ID",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Return private evidence or next step",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Record the provider order ID": {
      "main": [
        [
          {
            "node": "Return private evidence or next step",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveDataSuccessExecution": "none",
    "saveDataErrorExecution": "none",
    "saveManualExecutions": false,
    "saveExecutionProgress": false
  },
  "active": false
}
