Shipmind Labs

A promo code capped at 100 uses is not capped if you enforce it by reading the counter and writing it back. Two webhooks land at once, both read 99, both write 100, and both customers get the discount.

The cap needs a compare-and-set against the counts you actually validated, re-read on conflict. And a repeated idempotency key should hand back the first reservation instead of minting a second one. https://shipmindlabs.com/c/343a64c3

Was this useful?

Building something similar?

or email hello@shipmindlabs.com