{
  "name": "VAT pay-safe supplier check — CEE Data",
  "nodes": [
    {
      "parameters": {},
      "id": "manual-trigger",
      "name": "Check a supplier",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [-700, 80]
    },
    {
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            { "id": "supplier-nip", "name": "nip", "value": "5272677009", "type": "string" },
            { "id": "supplier-account", "name": "bankAccount", "value": "48124062921978001070145745", "type": "string" },
            { "id": "check-date", "name": "date", "value": "={{$today.toISODate()}}", "type": "string" }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "id": "supplier-input",
      "name": "Supplier NIP and bank account",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [-470, 80]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/cee-data~vat-whitelist-scraper/run-sync-get-dataset-items",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{JSON.stringify({mode:'paySafe',nips:[$json.nip],bankAccount:$json.bankAccount,date:$json.date,maxItems:1,maxConcurrency:1,maxRequestsPerMinute:10,maxRequestRetries:2,requestTimeoutSecs:20})}}",
        "options": { "timeout": 300000 }
      },
      "credentials": {
        "httpBearerAuth": { "id": "", "name": "Apify API token" }
      },
      "id": "vat-check",
      "name": "Verify with official VAT whitelist",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [-190, 80]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "return items.map((item) => {\n  const result = item.json;\n  const assigned = result.accountAssigned === true;\n  return { json: {\n    nip: result.nip ?? null,\n    accountAssigned: result.accountAssigned ?? null,\n    bankAccountLast4: result.bankAccountLast4 ?? null,\n    requestId: result.requestId ?? null,\n    requestDateTime: result.requestDateTime ?? null,\n    reviewRequired: !assigned,\n    message: assigned ? 'Bank account matches the supplier NIP in the official whitelist.' : 'STOP AND REVIEW: the account is not assigned to this NIP in the official whitelist.',\n    checkedAt: result.fetchedAt ?? null\n  } };\n});"
      },
      "id": "decision",
      "name": "Payment decision",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [100, 80]
    },
    {
      "parameters": {
        "content": "## Setup\n1. Open **Verify with official VAT whitelist** and create a **Bearer Auth** credential named **Apify API token**.\n2. Paste only your Apify token into **Bearer Token** and save.\n3. Replace the example NIP and 26-digit bank account, then execute the workflow.\n\nThe final node returns `reviewRequired: true` whenever the account is not assigned to the supplier NIP. Add your ERP, Google Sheets, Slack or email step after **Payment decision**.\n\nActor: https://apify.com/cee-data/vat-whitelist-scraper\nPrice: $0.015 per completed pay-safe check.",
        "height": 340,
        "width": 520
      },
      "id": "setup-note",
      "name": "Read me — setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-730, -330]
    }
  ],
  "connections": {
    "Check a supplier": { "main": [[{ "node": "Supplier NIP and bank account", "type": "main", "index": 0 }]] },
    "Supplier NIP and bank account": { "main": [[{ "node": "Verify with official VAT whitelist", "type": "main", "index": 0 }]] },
    "Verify with official VAT whitelist": { "main": [[{ "node": "Payment decision", "type": "main", "index": 0 }]] }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "tags": ["Apify", "VAT", "Accounting", "Poland", "Fraud prevention"]
}
