How would you design an idempotent payment API?hard
Use idempotency keys and store request-result mappings safely.
If a client retries after a timeout, the same key should return the same result instead of double-charging. Handle key expiry and request mismatch carefully.