Design a payment system with holds and batching
Company: OpenAI
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
## Scenario
Design a payment system that supports:
1. **Hold payment (authorization)**: Place a temporary hold on a customer’s payment method for a given amount.
2. **Batch process funds (settlement)**: Capture/settle authorized holds in batch (e.g., end-of-day) and move funds to the merchant.
3. **Charge payment (direct charge)**: Charge immediately (auth + capture) when batching is not desired.
The system must be reliable, idempotent, and auditable.
## What to cover
- APIs and core data model
- End-to-end flows (hold, capture/batch settlement, direct charge, cancel/release hold, refunds)
- Consistency guarantees and failure handling
- Idempotency strategy
- Handling duplicates, retries, partial failures
- Observability and reconciliation
- Security/compliance considerations (high level)
Quick Answer: This question evaluates a candidate's competency in designing reliable, auditable payment workflows, covering authorization holds, batch settlement, immediate charges, idempotency, failure handling, reconciliation, and security within the system design domain.