News for hackers. Stuff that matters.
Re:I don’t belong in tech by Illniyar on Saturday November 26, 2016 @03:56PM (#13045802)
If your using Java, there's a popular apache http framework[0] that automatically retries a failed request unless you specifically instruct it not to.

That bit us in the A$$ with double payments a few times.

0- https://hc.apache.org/httpcomponents-client-ga/httpclient/ap...

Re:I don’t belong in tech by magnetic on Saturday November 26, 2016 @08:23PM (#13047164)
If you rely on http to ensure the one-and-only-one type of paradigm, I have bad news for you (because you won't be able to distinguish failure vs success case when you hit a timeout: did it not receive the request or did I not receive the ack?).

You should embed a transaction ID to ensure idempotence of your API call. Then you can make the request 1, 2 or 3 times without any risk. The receiving end will realize the transaction ID already transitioned state and won't cause multiple payments to occur.

Re:I don’t belong in tech by Illniyar on Sunday November 27, 2016 @12:01AM (#13047814)
Obviously. But youd be surprised, some gateways don't let you send your own transactionId. Or at least they ignored it for determining duplicate requests. Though that was several years ago.