All Questions
Api Design medium

Stripe's API requires an Idempotency-Key header for POST requests. A client sends the same key twice. What should the server do on the second request?

  1. A Process the second request as a new transaction, as idempotency keys are intended for diagnostic tracing rather than functional deduplication.
  2. B Return the cached response from the successful first request immediately, ensuring the underlying state-changing operation is only executed once.
  3. C Return a 409 Conflict status code to inform the client that a resource with the same identifier or key already exists in the system.
  4. D Delete the existing record associated with that key and re-initialize the operation to ensure the final state reflects the latest request parameters.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions