Skip to content
CodeKruPro

A payment POST times out: is it safe to retry?

QuizMedium-HardAsked in: Accenture

A client sends POST /payments. The connection drops before any response arrives, so the client sends the same POST again. What is the risk, and what is the usual fix?

  • The first request may have succeeded, so the customer can be charged twice; many APIs accept a unique idempotency key header so the server can spot the repeat
  • No risk: POST is idempotent
  • No risk: a dropped connection means the server did nothing
  • Switch the call to GET so it can be retried

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in