Skip to content
RED SAGSkills
hardFull Stack Developer interview question

An order flow touches your database, a payment provider and an email service. How do you keep the system consistent when any step can fail?

What the interviewer wants to hear

  • No single transaction across external systems
  • Idempotency keys for retries with the payment provider
  • Transactional outbox for reliable events
  • Saga style steps with compensating actions
  • Webhooks verified and processed idempotently; reconciliation jobs

Model answer

I accept that there is no single transaction across my database, the payment provider and email, so I design for retries and partial failure. I model the order as a state machine: pending, paid, confirmed, failed. Creating the order and a pending payment record happens in one database transaction. Calls to the payment provider use an idempotency key, so a retry after a timeout cannot charge twice. The provider tells me the final result through a webhook, which I verify by signature and process idempotently, because webhooks can arrive late, twice or out of order. When the order becomes paid, I write an event to an outbox table in the same transaction, and a worker sends the email with at-least-once delivery. If a later step fails, I run a compensating action such as a refund, saga style. Finally, a daily reconciliation job compares my records with the provider to catch anything missed.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Full Stack Developer questions