69. A payment provider can deliver the same webhook repeatedly and out of order. Design order fulfillment around that behavior.
HardSystem design
Technical
Show model answer
Clarify the provider contract and the business states. Authenticate events using the supported mechanism, retain a unique event identity and process state changes transactionally. A repeated delivery should not create another shipment, and an older event must not undo a later valid state.
Separate recording an event from performing an external fulfillment side effect, using durable work and idempotent downstream operations where possible. Plan retries, reconciliation against provider state and manual resolution of ambiguous outcomes. Test duplicates, reordered events and crashes between each boundary.
What interviewers listen for
- Verified event identity
- Transactional state transitions
- Durable side-effect recovery
- Reconciliation