A payment provider timeout triggered client retries, and 340 customers were charged twice for one order.
Likely causes → Non-idempotent writes plus retries. The first request actually succeeded at the provider, but the response timed out, so the client (or a gateway or SDK retry policy) sent it again and created a second charge.
Diagnose → Join orders to provider charges by order ID and find orders with more than one successful charge; check gateway and SDK retry configuration and timeouts.
Fix → Refund the duplicates using the provider's API in a reviewed script, and tell affected customers.
Prevent → Send an idempotency key with every payment request (most payment APIs support an Idempotency-Key header), enforce uniqueness on your side (unique constraint on order ID plus charge type), retry only idempotent operations, and set client timeouts longer than the provider's typical latency.