System Design

Payment Gateway: Idempotency Key Architecture

System Design diagram · made in Skemio

System architecture of an idempotent payment gateway showing client token creation, atomic Redis locking, bank processing, and cached response replay.
System architecture of an idempotent payment gateway showing client token creation, atomic Redis locking, bank processing, and cached response replay.

What it shows

  • Clients generate a unique UUID idempotency key before sending the request.
  • An atomic lock prevents duplicate simultaneous requests from processing.
  • Completed responses are cached against the key to replay safely on retry.

The takeaway

Idempotency keys turn unpredictable network retries into safe operations that prevent double billing.

More system design diagrams