Retry with idempotency and idempotency keys to allow clients to pass a unique value.
In RESTful APIs, the PUT and DELETE verbs are idempotent.
However, POST may cause “double-charge” problem in payment. So we use a idempotency key to identify the request.
If the failure happens before the server, then there is a retry, and the server will see it for the first time, and process it normally.
If the failure happens in the server, then ACID database will guarantee the transaction by the idempotency key.
If the failure happens after the server’s reply, then client retries, and the server simply replies with a cached result of the successful operation. (View Highlight)