Bird
Raised Fist0
HLDsystem_design~12 mins

Payment integration architecture in HLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - Payment integration architecture

This system handles online payment processing for an e-commerce platform. It securely accepts payment requests from users, communicates with external payment gateways, and updates order status upon successful transactions. Key requirements include security, reliability, and scalability to handle many simultaneous payments.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
Payment Service <--> Cache
  |
  v
Database
  |
  v
Message Queue
  |
  v
External Payment Gateway
Components
User
client
Initiates payment requests via web or mobile app
Load Balancer
load_balancer
Distributes incoming payment requests evenly across API Gateway instances
API Gateway
api_gateway
Handles authentication, routing, and rate limiting for payment requests
Payment Service
service
Processes payment logic, interacts with cache, database, and message queue
Cache
cache
Stores recent payment session data to reduce database load
Database
database
Stores persistent payment and order records
Message Queue
queue
Queues payment confirmation messages for asynchronous processing
External Payment Gateway
external_service
Third-party service that processes actual payment transactions
Request Flow - 13 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayPayment Service
Payment ServiceCache
CachePayment Service
Payment ServiceDatabase
Payment ServiceMessage Queue
Message QueueExternal Payment Gateway
External Payment GatewayMessage Queue
Message QueuePayment Service
Payment ServiceCache
Payment ServiceAPI Gateway
API GatewayUser
Failure Scenario
Component Fails:Database
Impact:New payment records cannot be saved; payment status updates fail. Cached data may be stale.
Mitigation:Reads can still be served from cache; writes are retried or queued. Database replication and failover reduce downtime.
Architecture Quiz - 3 Questions
Test your understanding
Which component first handles the user's payment request after it passes through the Load Balancer?
APayment Service
BAPI Gateway
CCache
DDatabase
Design Principle
This architecture uses layered components to ensure secure, scalable payment processing. Caching reduces database load, asynchronous messaging decouples external payment processing, and load balancing ensures availability under high traffic.