All questions
Hard2026-08-23

Design a Large-Scale Payment Processing Platform

Company
Salesforce
Role

MTS

Round

Round 3 (System Design)

System DesignDistributed SystemsDatabase DesignIdempotency

Problem Statement

Design an end-to-end payment processing platform that handles transactions at scale. The system should be reliable, consistent, and fault-tolerant.

Think of building the backend for a service like Stripe or Razorpay.

Requirements

Functional:

  • Accept payment requests (amount, currency, source, destination)
  • Process payments through various payment gateways
  • Handle payment status tracking (initiated, processing, completed, failed, refunded)
  • Support retries for failed payments
  • Provide transaction history and receipts

Non-Functional:

  • Consistency: A payment must never be charged twice (idempotency)
  • Reliability: No data loss even during system failures
  • Latency: Sub-second response for payment initiation
  • Scale: Handle 10K+ transactions per second
  • Auditability: Full audit trail for compliance

What the Interviewer Expects

  1. Request flow: Client → API Gateway → Payment Service → Gateway Adapter → External Payment Provider → Callback/Webhook
  2. Idempotency: Every request carries an idempotency key. Store in DB before processing. Duplicate requests return cached result.
  3. State machine: Payment transitions: INITIATED → PROCESSING → COMPLETED/FAILED. No invalid transitions allowed.
  4. Database choices: Postgres for transactions (ACID), Redis for caching + rate limiting, Kafka for async event processing.
  5. Failure handling:
    • Gateway timeout → retry with exponential backoff
    • Ambiguous response → reconciliation job checks with gateway later
    • Service crash mid-transaction → recovery from last known state
  6. Retry mechanisms: Idempotent retries with the same key. Max retry count. Dead letter queue for permanently failed transactions.
  7. Monitoring: Real-time dashboard for success rates, latency p50/p99, failure alerts.

Follow-ups

  1. How do you handle partial failures in a multi-step payment (hold → charge → settle)?
  2. How would you design the refund flow? What are the edge cases?
  3. How do you handle currency conversion at scale?
  4. How would you implement fraud detection in the payment pipeline without adding latency?
  5. How do you ensure compliance (PCI-DSS)? What data can/cannot be stored?
🧠

No solution provided

Think through it. That's how you build real interview muscle.

Share: