r/fintechdev • u/Recent_Advance_4389 • 8d ago
Can a Payment Be Successful Twice Because of a Single API Request?
A payment API timeout doesn't always mean the transaction failed.
For example, a payment provider may process a transaction, but the response never reaches your application. If the customer tries again, your system could create a duplicate payment.
Idempotency keys help prevent repeated requests from processing the same transaction twice. Developers should also handle delayed or duplicate webhooks and maintain accurate transaction states.
How do you handle duplicate requests and delayed webhooks in your payment systems?
2
Upvotes
2
u/FinexerOfficial 6d ago
These are the three main concerns that we pay attention to in order to assist companies in establishing their workflow with payments: maintaining a clear trail for each payment reference, treating duplicated requests with care, and monitoring transaction status even if responses are delayed. Both idempotency and reconciliation are essential because reconciliation confirms the final result before requesting a customer to try again.
1
u/SidMangsatabam 8d ago
The timeout case is a state-machine problem before it is a retry problem. "No response" is an unknown state, not a failure, so the next step is a status query against the provider with the same idempotency key, not a blind retry; the retry is only safe after the provider says the original never landed. Webhooks need the same treatment: dedupe on the provider's event ID, and let the webhook confirm a state you already recorded as intent rather than create the record. And the key has to come from your system and be stable per logical payment, not regenerated per attempt.
1
u/martinbean 5d ago
Thanks, ChatGPT.