AI
Returns fraud evaluator
I built an AI fraud evaluator that holds suspicious returns for a person to review, instead of letting automation approve them.
- Company
- ReturnLogic
- Role
- Built the evaluator
- Period
- 2025
- Stack
- OpenAI · TypeScript · Node.js · PostgreSQL · AngularJS · Sequelize · Jest · Docker · ECS · Fargate
“Add to cart” takes you to the store with this project in your cart.
The risk
Retailers on ReturnLogic could authorize and process returns automatically, which is also the path a fraudulent return takes. Fraud leaves patterns in a shopper’s return history: the same item sent back again and again, the same return type or reason every time, a burst of returns in a short window.
How a return is judged
- ScoreRulesRules score the return’s fraud indicators. Clear-cut returns are settled here.
- JudgeOpenAIWhen the rules can’t decide, OpenAI decides whether to flag the return and writes its reasoning.
- HoldThe automationA flagged return is held back from automatic authorization and processing. It isn’t denied.
- DecideStaffStaff see the flag and the reasoning on the return and make the final call.
What testing caught
A provider abstraction let us A/B test prompts and swap providers without a rewrite. The test picked the prompt we shipped and exposed three guardrail gaps, which we closed.
- Flagging on thin evidenceThe model flagged returns the rule scores didn’t support.
- Inconsistent verdictsThe same return history could get different answers.
- Shopper text steering the modelReturn reasons and notes that shoppers write could sway the verdict.
Cost
Each evaluation got cheaper three ways: a shorter prompt, varied reasoning effort on one primary model, and calling the model only when the rules can’t decide.