{
  "name": "06 · E-commerce / Order → Fraud Check → Fulfillment",
  "active": false,
  "nodes": [
    {
      "id": "5a76a1c9-65c3-47dc-8b9a-8d9f5b17b9c7",
      "name": "📘 Guide",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        -120
      ],
      "parameters": {
        "content": "## 06 · E-commerce · Order → Fraud Check → Fulfillment\n\n### What this does\nNew order webhook runs fraud heuristics, inventory reserve, and shipping label stub; cancels/holds on risk.\n\n### Setup checklist\n1. Shopify/Woo webhook\n2. Fraud rules\n3. 3PL / ShipStation HTTP\n\n### How to test locally\nPOST `ecom-order` with order JSON.\n\n### Tips\n- Keep credentials in n8n Credentials (never hardcode secrets).\n- Use **Test URL** on the Webhook while developing.\n- Activate only after credentials + destinations are configured.\n",
        "width": 560,
        "height": 560,
        "color": 1
      }
    },
    {
      "id": "9fe54ab5-a5d3-43bc-89da-c9a1b99cb9fd",
      "name": "⚙️ Config",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        480
      ],
      "parameters": {
        "content": "## Config map\n\n- **Webhook path:** `ecom-order`\n- **Replace** all `https://httpbin.org/...` calls with real integrations.\n- **Credentials:** create in n8n → Credentials, then select on HTTP nodes.\n- **Activate** workflow only after a successful Test execution.\n\n### Local files\nShared host folder is mounted at `/files` inside n8n.",
        "width": 560,
        "height": 320,
        "color": 2
      }
    },
    {
      "id": "27aadf99-456c-403f-9ca6-c69c2004bf67",
      "name": "Intake Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        200
      ],
      "webhookId": "84f2361d-918e-4bdd-aec5-f222ea3109d6",
      "parameters": {
        "httpMethod": "POST",
        "path": "ecom-order",
        "responseMode": "responseNode",
        "options": {}
      }
    },
    {
      "id": "cb1abbe4-e1ed-4b41-abfd-e870e6eb2395",
      "name": "Validate & Risk Score",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        200
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const body = $input.first().json.body || $input.first().json;\nconst risk = Number(body.riskScore ?? (String(body.caption||body.copy||'').match(/guarantee|free money|urgent/i) ? 80 : 20));\nconst approved = risk < 60 || body.token === 'APPROVE' || body.autoApprove === true;\nreturn [{ json: { ...body, risk, approved, decision: approved ? 'pass' : 'hold' } }];"
      }
    },
    {
      "id": "4a5d5138-8ca2-4189-9c2f-a3ba85817e1d",
      "name": "Approved?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        560,
        200
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "1bbbf544-b9ec-40aa-b031-12bfe40095fd",
              "leftValue": "={{ $json.approved }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "ec3e0812-1203-4650-96d9-3e991b1da31b",
      "name": "Execute Action",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        840,
        80
      ],
      "parameters": {
        "method": "POST",
        "url": "https://httpbin.org/post",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}"
      }
    },
    {
      "id": "760b26e2-df44-4fd9-a9be-e591792ec218",
      "name": "Hold for Review",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        840,
        320
      ],
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "1",
              "name": "status",
              "value": "pending_approval",
              "type": "string"
            },
            {
              "id": "2",
              "name": "next",
              "value": "Send APPROVE token to resume / approve path",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "a8c0cce4-3f20-430c-b05e-e07c5d0d45b1",
      "name": "Webhook Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1120,
        200
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Intake Webhook": {
      "main": [
        [
          {
            "node": "Validate & Risk Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate & Risk Score": {
      "main": [
        [
          {
            "node": "Approved?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approved?": {
      "main": [
        [
          {
            "node": "Execute Action",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Hold for Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Action": {
      "main": [
        [
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hold for Review": {
      "main": [
        [
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "tags": [],
  "meta": {
    "templateCredsSetupCompleted": true,
    "description": "New order webhook runs fraud heuristics, inventory reserve, and shipping label stub; cancels/holds on risk."
  },
  "pinData": {}
}