Order Idempotency Key Collides Across Customers
Level 2 · node · API · Idempotency-Key scope error
Scenario
The order creation API stores Idempotency-Key values to prevent duplicate orders during mobile retries. A retry by the same customer with the same key should return the existing order, but when two different customers happen to use the same key, the second customer receives the first customer order. The service, idempotency repository, and order repository are separated.
Requirements
- A retry by the same customer with the same idempotency key returns the existing order - The same key used by a different customer creates an independent order - A different key for the same customer creates a new order - Returning an existing order on retry does not increase the order count - Stored idempotency records are addressable by customer and key together
Acceptance criteria
- Same customer and key reuses the existing order
- Same key for another customer creates a new order
- Different key for the same customer creates a new order
- Retry does not increase order count
- Idempotency records preserve customer scope