Design a scalable payment processor
Company: OpenAI
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
Design an online payment processing platform for merchants to accept card and digital wallet payments. Cover:
- API design (authorize, capture, refund, void), idempotency keys, and exactly-once charge semantics.
- End-to-end flow across gateway, acquirer, networks, and issuers; tokenization and PCI scope boundaries.
- Risk and fraud controls: 3DS/SCA, risk scoring, velocity limits, and optional ML integration.
- Data model and storage for transactions, ledgers, settlements, chargebacks, and immutable audit logs.
- Consistency model, deduplication, retries, and orchestration patterns (outbox/SAGA) for multi-step workflows.
- Settlement and reconciliation with acquirers, currency conversion, fees, and scheduled payouts.
- Scalability targets (e.g., thousands of TPS, p99 latency < 200 ms), backpressure, and queueing.
- High availability and disaster recovery (multi-region active-active, RPO/RTO objectives).
- Observability (metrics, tracing, log correlation), access control, PII/GDPR handling, and key management.
- Testing strategy, simulators/mocks for external partners, and handling timeouts and partial failures.
Quick Answer: This question evaluates skills in large-scale distributed system design, secure payment processing, transactional consistency (idempotency and exactly-once semantics), regulatory compliance (PCI/PSD2/GDPR), data modeling for ledgers and audit logs, integration with external networks, and operational concerns like scalability, resilience, and observability. It is commonly asked because interviewers need to assess architectural trade-offs, fault-tolerance and orchestration for multi-step money flows, reconciliation and settlement logic; the category is System Design and the level of abstraction spans both high-level conceptual architecture and detailed practical application.