Citizens report double charges on a fee API. Logs show the payment handler processing the same retried request twice without an idempotency check. What is the most likely code-level root cause to fix?
Select an answer to reveal the explanation.
Short Explanation
Retries are the post office ringing the doorbell twice—if your fee handler does not recognize the same ticket, it charges twice. Idempotency is the "already stamped" mark; missing it is a code bug, not a log-retention tax.
Full Explanation
When citizens report double charges and logs show the payment handler processing the same retried request twice without an idempotency check, the most likely code-level root cause is application logic that lacks idempotency protection. Retries from API clients, API Gateway, or intermediate networks are normal under load; fee handlers must recognize a payment key or idempotency token and avoid executing the charge side effect twice for the same logical citizen request.
CloudWatch retention set to fourteen days affects log storage duration; it does not duplicate charges. An X-Ray sampling rule controls trace volume and cost; it does not bill citizens per segment. A missing API Gateway custom domain affects DNS branding; it does not inherently double-post payments when retries arrive.
Exam caveat: distinguish infrastructure misconfiguration distractors from application correctness issues—idempotency is a classic developer responsibility for payment-like side effects on DVA-C02 troubleshooting items.
Operational check: reproduce a retried fee request with the same idempotency key, confirm only one charge executes, add automated tests for duplicate delivery, and monitor for duplicate settlement events before returning the municipal fee API to full traffic.