What is Idempotency and Why We Need It
Too Long; Didn't Read
Idempotency is a strategy that makes sure an event that executed multiple times will give the same result. For example, GET method is not idempotent because every time you call an endpoint with POST method will create a new record on the database (the database state changes) Backend should have a mechanism to store the unique identifier for each request. Maybe we can use Redis to store it temporarily. Backend receives the request, makes a new transaction, and reduces the user’s balance. But somehow network failure happened and the frontend app does not receive the response.