
Idempotency in Payments: The Backend-Generated Key Approach
The flow is split into two steps, and the backend generates the ID, which tightly couples the payment to a real row in your database.
Software Engineer exploring AI, system design, and the art of building great products.

The flow is split into two steps, and the backend generates the ID, which tightly couples the payment to a real row in your database.

Before making a payment request, the client app (like your React frontend or Android app) generates a unique string representing the *intent* of the transaction. Usually we just use a V4 UUID.

In the world of distributed systems, networks are inherently unreliable. Requests get dropped, database connections stall, and packets vanish into the void. To combat this, we build systems that automatically retry failed operations. But retries introduce a dangerous new problem: what happens if the original request actually succeeded, but the acknowledgment was lost?

High intelligence and ADHD are a powerful combo for entrepreneurs, but they often lead to a graveyard of unfinished ideas. Learn how to stop procrastinating and start shipping.
A deep dive into how I built this blog using Next.js, MDX, and a custom design system with light/dark theme support.