Skip to content
RED SAGSkills
hardFull Stack Developer interview question

Design an e-commerce checkout end to end: cart, payment with a provider like Stripe, inventory and order confirmation. What can go wrong and how do you make it reliable?

What the interviewer wants to hear

  • Server calculates prices and totals, never trusting the client
  • Reserve or atomically decrement inventory to avoid overselling
  • Use idempotency keys for payment requests
  • Treat verified webhooks as the source of truth for payment status
  • Model the order as a state machine and make handlers idempotent
  • Send emails and other side effects through a queue or outbox

Model answer

The client only sends cart item IDs and quantities; the server looks up prices, discounts and tax, so totals cannot be tampered with. When the user starts checkout, I create an order in PENDING state and reserve stock with an atomic conditional update, so two buyers cannot take the last item; reservations expire if payment never completes. I create a Stripe PaymentIntent with an idempotency key tied to the order, so retries never double charge. The browser confirms the payment, but I mark the order PAID only when a signature-verified webhook arrives, because the user might close the tab. Webhook handlers are idempotent, since providers retry, and the order moves through a clear state machine. Confirmation emails and fulfilment go through an outbox or job queue. A daily reconciliation job compares orders with the provider’s records 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