Cash-on-delivery is a black hole.
D2C brands in India ship 60–70% of orders as COD. A meaningful chunk of those return to origin — wrong addresses, ghost numbers, buyer's remorse, fake orders. Reverse logistics burns money; the warehouse picks, packs and dispatches inventory that never converts.
The existing setup was reactive: orders flowed to the warehouse the moment they came in. By the time a risky order was flagged, the parcel was already in transit. No pre-shipment filter, no signal aggregation, no automated verification — just a spreadsheet of regrets at month-end.
Build a decision engine, not a dashboard.
The system intercepts every COD order at creation, combines three independent signals, and decides one of three things: auto-approve, call the customer, or push toward prepaid conversion. Nothing reaches the warehouse without a cod-verified tag.
- GoKwik risk tier — the order's historical risk band from the checkout layer.
- Pincode RTO history — a pre-computed lookup of every Indian pincode's failure rate against our shipping history.
- EasyEcom suspicious-consignee flag — repeat-offender phone numbers and address fingerprints from the WMS.
Three paths, one tag.
Tag-gating is the whole trick. The warehouse's automation only picks orders tagged cod-verified or cod-autopass. Anything tagged cod-unverified sits in Shopify, frozen, until the decision engine resolves it.
- Low-risk repeat buyers → auto-approve, tag cod-autopass, flow to warehouse within seconds.
- Mid-risk first-timers → Formant AI calls the customer three times in 24 hours; outcome writes back to Shopify as a tag.
- Stacked-signal high-risk → no call, no warehouse. Customer gets a prepaid-conversion nudge instead.
Production from day one.
Deployed at webhooks.ccapps.xyz on AWS Tokyo. Shopify webhooks trigger the FastAPI service, which decisions in under 400ms and writes tags back atomically. Formant AI handles the outbound calling layer; the WMS reads tags via its standard order-status sync.
The whole system ships with a runbook: state machine diagrams, tag lifecycle, backtest methodology, AWS deployment steps, and a HANDOFF.md so any engineer can take over.
Live, automated, owned.
The pipeline runs unattended. The ops team sees a daily summary; nothing else changes for them. The warehouse no longer dispatches doomed parcels. Customer service stops chasing failed deliveries that should never have shipped.
Built solo. Backtested on a quarter-million historical orders before going live. Full ops handoff documentation included.