← All comparisons

Payment Gateway vs URL Shortener

Payment System

Payment System

Pay-in flow through a PSP, double-entry ledger and wallet, idempotency for exactly-once, plus reconciliation against settlement files.

Components (13)

  • E-commerce Backend
  • API Gateway
  • Payment Service
  • Idempotency Store
  • Risk / Fraud Check
  • Payment Executor
  • PSP
  • Card Schemes
  • Retry + Dead Letter Queue
  • Wallet
  • Ledger
  • Payments DB
  • Reconciliation

Headline numbers

  • Txn TPS (avg)~10/sec
  • Txn TPS (peak)~50/sec
  • Ledger writes / sec (peak)~100
URL Shortener

URL Shortener

Hashing, key generation, read-heavy caching.

Components (6)

  • Client
  • API Gateway
  • Write Service
  • Read Service
  • Redis
  • Postgres

Headline numbers

  • Write QPS (avg)~1,200/sec
  • Read QPS (avg)~120,000/sec
  • Storage per year~5 TB

Key differences

Only in Payment Gateway
  • PSP
  • Retry + Dead Letter Queue
In both
  • Client
  • Api Gateway
  • Service
  • Cache
  • Database
Only in URL Shortener
None.

Flow shape

Payment Gateway flows
  • Pay-in: charge a card10 steps
  • Reconciliation (settlement file)3 steps
  • Payment order fails: retry then DLQ4 steps
  • Idempotency store is cold5 steps
URL Shortener flows
  • Shorten a URL3 steps
  • Resolve short URL (cache hit)3 steps
  • Resolve short URL (cache miss)4 steps
  • Redis is down4 steps