A user clicks “Pay”, the network drops, the client retries… and your backend creates two payments. This isn’t a “frontend bug”. Retries happen everywhere: mobile networks API gateways with automatic retry load balancers / timeouts users smashing the refresh button If your POST endpoint creates something with side effects (charge card, create order, send email), you want idempotency . This post shows a pragmatic, production-friendly implementation of Idempotency-Key in Spring Boot. What idempotency means With an idempotency key, the client sends a header: Idempotency-Key: 7f3b2c1c-4f4f-4c8d-9b7e-0f18d4d0b2aa Enter fullscreen mode Exit fullscreen mode Your API guarantees: First request with that key executes normally Subsequent requests with the same key return the same result If another request with the same key is in progress , you respond predictably (409/202) instead of doing the work twice The key idea: store the outcome of the first request and replay it .…