Design a scalable payment system
Company: OpenAI
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Technical Screen
Design a payment system that supports moving money between users and paying merchants.
Your design should cover:
- Core product requirements: user-to-user transfers, merchant payments, refunds/chargebacks (if applicable), payment status tracking, transaction history.
- Non-functional requirements: correctness (no double-spend), idempotency, high availability, low latency, auditability, compliance considerations, and scalability.
- Money movement model: ledger design (e.g., double-entry), authorization vs capture (if cards), holds, settlement, and reconciliation.
- APIs and data model: key endpoints, request/response fields, idempotency keys, and how you represent accounts/balances/transactions.
- Failure handling: retries, exactly-once vs at-least-once processing, deduplication, consistency guarantees.
- Security and risk: authentication, authorization, encryption, fraud detection hooks, limits, and monitoring.
Assume the system may integrate with external payment rails/providers (e.g., card networks, bank transfers). Explain key trade-offs and provide a high-level architecture diagram in words.
Quick Answer: This question evaluates system design and financial-systems competencies, including distributed systems, transactional integrity, ledger and money-movement models, API and data-model design, failure handling, security, compliance, and operational concerns like scalability and auditability.