{"product_id":"n8n-workflow-log-ai-refund-decisions-as-execution-data","title":"n8n Workflow: Log AI Refund Decisions as Execution Data","description":"\u003ch3\u003eLog AI refund decisions as Execution Data—so you can audit every run in n8n\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow receives a refund request, uses a demo refund policy to choose \u003cem\u003erefund_approved\u003c\/em\u003e, \u003cem\u003erefund_declined\u003c\/em\u003e, or \u003cem\u003eneeds_human_review\u003c\/em\u003e, asks an AI agent to explain the reasoning, and then saves the full case and final outcome directly into \u003cstrong\u003ecustom execution data\u003c\/strong\u003e for later search and inspection.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAccepts refund input via Webhook:\u003c\/strong\u003e handles a POST request with \u003ccode\u003eorderId\u003c\/code\u003e, \u003ccode\u003ecustomerTier\u003c\/code\u003e, and \u003ccode\u003emessage\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLooks up the order (simulated):\u003c\/strong\u003e returns a demo order record for this exercise.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSelects a policy decision:\u003c\/strong\u003e uses a “Policy Decision” step with an Edit Fields node to set \u003ccode\u003erefund_approved\u003c\/code\u003e, \u003ccode\u003erefund_declined\u003c\/code\u003e, or \u003ccode\u003eneeds_human_review\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePrevents oversized execution tag values:\u003c\/strong\u003e checks tag length; if values exceed 255 characters, it routes to “Reject Oversized Tag,” then uses a \u003cem\u003eStop and Error\u003c\/em\u003e node.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSaves case details to Execution Data:\u003c\/strong\u003e a dedicated Execution Data node stores the case for traceability.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eExplains the decision with an AI agent:\u003c\/strong\u003e “Refund Support Agent” generates an explanation using an \u003cstrong\u003eOpenRouter chat model\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eStores the final decision as custom execution data:\u003c\/strong\u003e “Record Decision” writes the outcome so you can open the saved execution later and filter by custom data (n8n Cloud Pro\/Enterprise required for advanced filtering).\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eAuditing customer support refund decisions across environments.\u003c\/li\u003e\n  \u003cli\u003eBuilding traceable AI workflows for SaaS operations and incident review.\u003c\/li\u003e\n  \u003cli\u003eTraining your team on audit \u0026amp; trace patterns from the n8n Production AI Playbook (Audit \u0026amp; Trace, Exercise 2).\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eTrigger:\u003c\/strong\u003e Webhook (POST)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLogic\/controls:\u003c\/strong\u003e If, Set, Code\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGuardrails:\u003c\/strong\u003e Stop and Error for oversized tag values\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAI integration:\u003c\/strong\u003e OpenRouter (template uses \u003ccode\u003eopenai\/gpt-4.1-mini\u003c\/code\u003e, but any supported chat model works)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eTraceability:\u003c\/strong\u003e Execution Data + custom execution fields\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46157935935667,"sku":"N8N-20344","price":46.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/RAZ61pHiSFuYZLrDDa1Kp_CnCQ58Yu.png?v=1791018916","url":"https:\/\/buyflowscripts.com\/products\/n8n-workflow-log-ai-refund-decisions-as-execution-data","provider":"N8N Commerce","version":"1.0","type":"link"}