Designing a Shopify to 3PL sync that survives retries
Practical rules for syncing Shopify orders with a courier or 3PL API: idempotency, status mapping, scheduled reconciliation and COD tracking.
By Afkhan Fardeen Khan · Published · Updated
Syncing orders between Shopify and a 3PL looks like one API call until a request times out and the same order is shipped twice. These are the rules I follow when building the SeisSense Ops Portal, which connects two Shopify stores to a courier API and Zoho Books.
1. Make every write idempotent
Key each outbound request on the Shopify order ID. Before creating a shipment, check whether one already exists for that order. A retry should be harmless.
2. Keep your own status, and map the courier's
Couriers use their own status vocabulary. Store the raw status and map it to a small internal set (pending, in transit, delivered, failed). Dashboards and COD tracking read the internal status; the raw value stays for debugging.
3. Reconcile on a schedule
Webhooks get missed. A scheduled job, for example Vercel Cron, should periodically compare open orders against the courier and repair differences. Log each run so you can see when it last succeeded.
4. Treat COD as a ledger, not a flag
For cash on delivery, record what was expected, what the courier remitted and when. A COD view that shows only delivered versus not delivered hides the money that is missing.
5. Show failures to humans
- A health page with the last successful run per job.
- Failed syncs listed with the order number and the reason.
- A manual retry button for operations staff.
Do these five things and the sync becomes a system the operations team trusts rather than one they double-check in three tools.