PracHub
QuestionsLearningGuidesInterview Prep
|Home/System Design/OpenAI

Design a Reliable Payment Processing System

Last updated: Jul 22, 2026

Quick Overview

Design a reliable payment-processing service that prevents duplicate charges and preserves an auditable state history through retries and partial failures. Cover idempotency, exact money representation, timeout ambiguity, asynchronous callbacks, reconciliation, state transitions, partitioning, and operational controls.

  • medium
  • OpenAI
  • System Design
  • Software Engineer

Design a Reliable Payment Processing System

Company: OpenAI

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Onsite

# Design a Reliable Payment Processing System Design a payment-processing service for merchants. A client creates a payment, the service submits it to an external payment processor, asynchronous updates may arrive later, and the merchant must be able to retrieve the authoritative status. Focus on preventing duplicate charges and preserving an auditable money trail under retries and partial failures. ### Constraints & Assumptions - Clients, services, queues, and the external processor can time out or retry. - A timeout does not prove that the processor rejected the request. - Payment state changes must be durable and auditable. - Monetary values use an exact minor-unit representation plus currency. - The initial design may support one processor, but should expose a clean integration boundary. ### Clarifying Questions to Ask - Which operations are required beyond authorization and capture, such as voids or refunds? - Is capture immediate or separate from authorization? - What consistency and status freshness do merchants require? - Which party supplies the idempotency key, and how long is it retained? ### Part 1: API, State, and Data Model Define the create/read interfaces, payment state machine, idempotency behavior, and durable records. #### What This Part Should Cover - Stable payment and attempt IDs, exact amounts, and immutable request identity. - Valid state transitions with append-only events or equivalent audit evidence. - Idempotent retries that return the original logical result. ### Part 2: External Processing and Reconciliation Explain how the service handles submission, timeouts, callbacks, duplicate messages, and disagreement with the processor. #### What This Part Should Cover - Durable intent before side effects and a reliable dispatch pattern. - Correlation IDs, signed callback validation, deduplication, and monotonic transitions. - An explicit unknown/pending state plus periodic reconciliation. ### Part 3: Reliability and Operations Describe scaling, tests, observability, and controls for sensitive operations. #### What This Part Should Cover - Partitioning without losing per-payment serialization. - Retry limits, dead-letter review, backpressure, and processor circuit breaking. - Fault-injection and invariant tests around every persistence/network boundary. - Metrics and audit controls that support incident investigation. ### What a Strong Answer Covers - Idempotency at both the client boundary and external-processor boundary. - A precise state machine that never equates timeout with failure. - Durable events, reconciliation, and safe duplicate/out-of-order handling. - Exact money representation, authorization boundaries, and operational visibility. ### Follow-up Questions - How would you migrate an in-flight merchant from one processor to another? - How would you model a partial refund without corrupting the original payment history? - Which invariant would you continuously verify to detect duplicate capture?

Quick Answer: Design a reliable payment-processing service that prevents duplicate charges and preserves an auditable state history through retries and partial failures. Cover idempotency, exact money representation, timeout ambiguity, asynchronous callbacks, reconciliation, state transitions, partitioning, and operational controls.

Related Interview Questions

  • Design a Payment Lifecycle from Hold to Charge and Settlement - OpenAI (medium)
  • Design a Payment Orchestration System - OpenAI (medium)
  • Design an Asynchronous Text-to-Video Generation Service - OpenAI (medium)
  • Design an Online Chess Service from Launch to Scale - OpenAI (medium)
  • Design a Highly Available Conversational AI Service - OpenAI (medium)
|Home/System Design/OpenAI

Design a Reliable Payment Processing System

OpenAI logo
OpenAI
May 2, 2026, 12:00 AM
mediumSoftware EngineerOnsiteSystem Design
1
0

Design a Reliable Payment Processing System

Design a payment-processing service for merchants. A client creates a payment, the service submits it to an external payment processor, asynchronous updates may arrive later, and the merchant must be able to retrieve the authoritative status. Focus on preventing duplicate charges and preserving an auditable money trail under retries and partial failures.

Constraints & Assumptions

  • Clients, services, queues, and the external processor can time out or retry.
  • A timeout does not prove that the processor rejected the request.
  • Payment state changes must be durable and auditable.
  • Monetary values use an exact minor-unit representation plus currency.
  • The initial design may support one processor, but should expose a clean integration boundary.

Clarifying Questions to Ask Guidance

  • Which operations are required beyond authorization and capture, such as voids or refunds?
  • Is capture immediate or separate from authorization?
  • What consistency and status freshness do merchants require?
  • Which party supplies the idempotency key, and how long is it retained?

Part 1: API, State, and Data Model

Define the create/read interfaces, payment state machine, idempotency behavior, and durable records.

What This Part Should Cover Guidance

  • Stable payment and attempt IDs, exact amounts, and immutable request identity.
  • Valid state transitions with append-only events or equivalent audit evidence.
  • Idempotent retries that return the original logical result.

Part 2: External Processing and Reconciliation

Explain how the service handles submission, timeouts, callbacks, duplicate messages, and disagreement with the processor.

What This Part Should Cover Guidance

  • Durable intent before side effects and a reliable dispatch pattern.
  • Correlation IDs, signed callback validation, deduplication, and monotonic transitions.
  • An explicit unknown/pending state plus periodic reconciliation.

Part 3: Reliability and Operations

Describe scaling, tests, observability, and controls for sensitive operations.

What This Part Should Cover Guidance

  • Partitioning without losing per-payment serialization.
  • Retry limits, dead-letter review, backpressure, and processor circuit breaking.
  • Fault-injection and invariant tests around every persistence/network boundary.
  • Metrics and audit controls that support incident investigation.

What a Strong Answer Covers Guidance

  • Idempotency at both the client boundary and external-processor boundary.
  • A precise state machine that never equates timeout with failure.
  • Durable events, reconciliation, and safe duplicate/out-of-order handling.
  • Exact money representation, authorization boundaries, and operational visibility.

Follow-up Questions Guidance

  • How would you migrate an in-flight merchant from one processor to another?
  • How would you model a partial refund without corrupting the original payment history?
  • Which invariant would you continuously verify to detect duplicate capture?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More OpenAI•More Software Engineer•OpenAI Software Engineer•OpenAI System Design•Software Engineer System Design

Your design canvas — auto-saved

PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.