Note • Nov 2, 2025
Shopify Webhook Retries That Don't Double-Write
Idempotent webhook retries.
The Problem
Shopify retries webhooks when your endpoint is slow or returns 5xx. Without idempotency, the same inventory_levels/update event could decrement stock twice.
Approach
- Persist first — store the raw body and headers before doing any business logic.
- Idempotency key — derive from Shopify’s event ID (or a hash of topic + resource + updated_at).
- Short-circuit duplicates — if the key exists in a processed table, return 200 immediately.
- Dead-letter — validation failures go to a review queue, not infinite retry loops.
Operational Win
Support could answer “what happened to order X?” by looking at job state instead of grep-ing logs.
When This Matters
Any webhook source that retries: Stripe, ShipStation, EDI adapters, internal event buses.