← Openai Interview Insights

Openai·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Apr 2026

Summary

System design round at OpenAI for a software engineer role, focused entirely on designing a payment system from scratch. The question was dense and they clearly expected you to cover a lot of ground without much prompting.

Questions Asked (1)

Q1

Design a payment system that supports placing holds on funds, batch processing of those holds (capture, release, or expiry), and direct charges. Cover the data model, idempotency, two-phase commit semantics, retry and timeout behavior, refunds, fraud detection, double-spend prevention, ledger design, reconciliation, observability, and how you'd scale it.

System DesignData ModelingTechnical Trade-offs
Author's notes

This thing has so many layers that I spent the first few minutes just trying to figure out where to start.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scope, then walk through the core data model and state machine for holds and charges, emphasizing idempotency and two-phase commit semantics. Structure your answer around the lifecycle of a payment (hold → capture/release/expiry, direct charge, refund) and weave in cross-cutting concerns like fraud, ledger, reconciliation, observability, and scaling. Use concrete examples and trade-offs to demonstrate depth.

Pro tip: Anchor your design on an append-only ledger with idempotency keys and a state machine for holds; this naturally addresses double-spend, reconciliation, and auditability. Explicitly call out failure modes (e.g., timeout during capture) and how you'd handle them with retries and compensating actions.

1. Clarify Requirements and Scope

Ask clarifying questions about scale, consistency needs, supported payment methods, and regulatory constraints. Define the core entities: accounts, holds, charges, refunds, and ledger entries.

2. Design Data Model and State Machine

Model holds with states (PENDING, CAPTURED, RELEASED, EXPIRED) and link them to charges. Use an append-only ledger for immutable financial records and ensure idempotency keys on all mutating operations.

3. Define Two-Phase Commit and Idempotency

Explain how holds reserve funds (phase 1) and capture/release finalizes them (phase 2). Use idempotency keys and unique constraints to prevent duplicate operations, and describe timeout/retry behavior with exponential backoff and dead-letter queues.

4. Address Fraud, Double-Spend, and Refunds

Incorporate fraud detection (rules, ML, velocity checks) at hold and capture time. Prevent double-spend via atomic balance updates and ledger consistency. Handle refunds as reverse ledger entries linked to original charges.

5. Cover Reconciliation, Observability, and Scaling

Describe reconciliation jobs that compare internal ledger with external statements. Add observability (metrics, tracing, logging) and scale via sharding, async processing, and caching while maintaining consistency.

Key Points to Mention

  • Idempotency keys and exactly-once semantics for all payment operations
  • Append-only ledger with double-entry accounting for auditability and reconciliation
  • State machine for holds with clear transitions and timeout-based expiry
  • Two-phase commit semantics: reserve funds then capture/release, with compensating actions on failure
  • Fraud detection integration at multiple stages (hold creation, capture) and velocity checks
  • Scalability strategies: sharding by account ID, async batch processing, and read replicas for reconciliation

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.