← Stripe Interview Insights

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

Senior
Apr 2026

Summary

System design round at Stripe for a software engineer role, focused entirely on building a ledger service for a payments platform. Pretty deep dive, way more nuance than I expected going in.

Questions Asked (6)

Q1

Design a ledger service for a payments platform with at least two APIs: one to record a financial transaction between parties, and one to return the current or historical balance for a merchant.

System DesignAPI & IntegrationsData Modeling
Author's notes

I started with the APIs and felt okay about the surface area, but the money representation question is where I stumbled.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: double-entry ledger, immutability, auditability, and balance query needs (current and historical). Then design the data model and APIs, focusing on correctness, consistency, and scalability. Finally, discuss trade-offs and potential optimizations.

Pro tip: Emphasize that a ledger is append-only and balances are derived from entries, not stored as mutable state. This shows you understand financial systems' need for auditability and correctness.

1. Clarify Requirements

Ask about transaction types, currencies, consistency requirements, and query patterns. Confirm that balances must be accurate and auditable.

2. Design Data Model

Propose an append-only ledger with double-entry accounting: each transaction creates balanced debit/credit entries. Include fields like transaction_id, account_id, amount, currency, timestamp.

3. Define APIs

Design RESTful endpoints: POST /transactions to record a transaction, and GET /accounts/{id}/balance?as_of=timestamp to retrieve balance. Specify request/response schemas.

4. Ensure Consistency and Scalability

Discuss ACID transactions for writes, idempotency keys, and how to compute balances efficiently (e.g., materialized views, caching, or periodic snapshots).

5. Address Edge Cases and Trade-offs

Cover handling of failed transactions, reversals, multi-currency, and historical balance queries. Discuss trade-offs between consistency and availability.

Key Points to Mention

  • Double-entry accounting: every transaction has equal debits and credits.
  • Immutability: ledger entries are never updated or deleted; corrections are made via compensating entries.
  • Idempotency: use idempotency keys to prevent duplicate transactions.
  • Balance calculation: derive from entries, use snapshots or caching for performance.
  • Historical balances: support as-of queries by filtering entries by timestamp.
  • Auditability: maintain a complete audit trail with timestamps and metadata.

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

Q2

How would you represent monetary amounts in your API and database to avoid precision errors, and what are your rounding rules?

Data ModelingTechnical Trade-offsAPI & Integrations
Author's notes

Blanked for a second and said 'avoid floats, use decimals' which is half right but not the answer they wanted.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining that monetary amounts should be stored as integers in the smallest currency unit (e.g., cents) to avoid floating-point precision issues. Then discuss the importance of consistent rounding rules, such as using banker's rounding or half-up, and how to handle currency-specific decimal places. Finally, mention API design considerations like using strings for monetary values to preserve precision and avoid JSON number limitations.

Pro tip: Mention that Stripe's API uses integers for amounts in the smallest currency unit and that you should always validate and round at the boundaries of your system to prevent drift. Also, consider using a dedicated money library or type to encapsulate currency and amount.

1. Identify the problem with floating-point

Explain that floats like IEEE 754 cannot represent many decimal fractions exactly, leading to precision errors in calculations and storage.

2. Choose integer representation

State that storing amounts as integers in the smallest unit (e.g., cents) avoids precision issues and is a common industry practice.

3. Define rounding rules

Describe when and how to round: at input, during calculations, and at output. Specify a consistent rounding mode (e.g., half-up, half-even) and document it.

4. Handle multi-currency and decimal places

Note that different currencies have different minor unit exponents (e.g., JPY has 0, USD has 2, KWD has 3) and ensure your system accounts for that.

5. Design API and database schema

Recommend using integers in the database and API, and consider representing amounts as strings in JSON to avoid number precision limits in some clients.

Key Points to Mention

  • Use integers in the smallest currency unit (e.g., cents) for storage and calculations.
  • Avoid floating-point types (float, double) for monetary values.
  • Define and document rounding rules (e.g., half-up, half-even) and apply consistently.
  • Account for currency-specific decimal places (e.g., USD=2, JPY=0).
  • Consider using a Money library or type to encapsulate amount and currency.
  • In APIs, represent amounts as integers or strings to preserve precision across languages.

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

Q3

How do you make the record_transaction endpoint idempotent so that client retries don't result in double-counted transactions?

System DesignTechnical Trade-offs
Author's notes

This one I actually had a decent answer for.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining idempotency in the context of payment APIs and why it's critical for Stripe. Then propose a concrete mechanism, such as client-supplied idempotency keys with server-side deduplication, and discuss trade-offs like storage, TTL, and race conditions.

Pro tip: Mention that idempotency keys should be scoped to the user and endpoint, and that you'd store the response along with the key to return the same result on retry. Also highlight the importance of handling concurrent requests with the same key using locks or atomic operations.

1. Clarify requirements and constraints

Confirm that the endpoint must be idempotent for retries, and discuss expected retry behavior, latency, and consistency requirements.

2. Choose an idempotency mechanism

Propose using a client-generated idempotency key (e.g., UUID) sent in a header, and explain how the server uses it to deduplicate requests.

3. Design storage and lookup

Describe storing the key with the response and a TTL in a fast data store like Redis or a database, ensuring atomic check-and-set to handle races.

4. Handle edge cases and failures

Discuss what happens if the first request is still in progress, if the key expires, or if the client retries with a different payload.

5. Discuss trade-offs and alternatives

Compare with other approaches like natural idempotency (e.g., using transaction IDs) and explain why idempotency keys are preferred for payment APIs.

Key Points to Mention

  • Idempotency keys should be unique per request and scoped to the user/API key to prevent collisions.
  • Store the idempotency key along with the response status and body to return the same result on retry.
  • Use a TTL (e.g., 24 hours) to avoid unbounded storage growth, and document the expiration behavior.
  • Handle concurrent requests with the same key using distributed locks or atomic operations to prevent double processing.
  • Validate that retries with the same key have identical request payloads; reject if they differ.
  • Consider using a database unique constraint on the idempotency key as a simple deduplication method.

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

Q4

How do you ensure atomicity when recording a transaction that involves both a debit and a credit?

System DesignTechnical Trade-offs
Author's notes

Straightforward if you know databases.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining atomicity in the context of financial transactions: both debit and credit must succeed or fail together. Then explain how you would achieve this using database transactions with ACID properties, and discuss trade-offs like isolation levels and distributed transaction patterns for scale.

Pro tip: Mention Stripe's idempotency keys and how they prevent duplicate transactions, showing you understand real-world payment systems. Also, highlight the importance of logging and monitoring to detect and resolve inconsistencies.

1. Define the requirement

Clarify that atomicity means the debit and credit are treated as a single indivisible operation; either both are applied or neither is.

2. Use database transactions

Explain that wrapping the operations in a database transaction (e.g., BEGIN/COMMIT) ensures atomicity, with rollback on failure.

3. Consider isolation and locking

Discuss isolation levels (e.g., serializable) and locking mechanisms to prevent race conditions and ensure consistency.

4. Address distributed scenarios

If the system is distributed, mention two-phase commit (2PC) or saga patterns to maintain atomicity across services.

5. Handle failures and idempotency

Describe how to handle partial failures with retries, idempotency keys, and compensating transactions to avoid double-spending.

Key Points to Mention

  • ACID properties, especially atomicity and consistency
  • Database transactions and rollback mechanisms
  • Isolation levels and locking (e.g., SELECT FOR UPDATE)
  • Two-phase commit (2PC) for distributed transactions
  • Idempotency keys to prevent duplicate operations
  • Trade-offs between consistency and availability (CAP theorem)

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

Q5

How would you design the storage layer to support fast balance lookups at scale, given a potentially huge append-only ledger?

System DesignData ModelingTechnical Trade-offs
Author's notes

This is where the conversation got interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: read/write patterns, consistency needs, and scale. Then propose a hybrid architecture: append-only ledger as source of truth, with a derived materialized view (e.g., key-value store) for fast balance lookups, updated asynchronously or transactionally. Discuss trade-offs between consistency, latency, and complexity.

Pro tip: Emphasize idempotency and exactly-once processing when updating derived balances, as financial systems require correctness. Also, mention the importance of backfilling and reconciliation to handle failures.

1. Clarify Requirements

Ask about read/write ratio, latency SLAs, consistency requirements (strong vs eventual), and scale (transactions per second, data size).

2. Design the Ledger

Propose an append-only ledger as the immutable source of truth, using a distributed log (e.g., Kafka) or a database with append-only tables, partitioned by account or time.

3. Derive Balances

Introduce a materialized view (e.g., key-value store like Redis or DynamoDB) that stores the current balance per account, updated by consuming ledger events.

4. Ensure Consistency

Discuss how to keep the derived balance consistent: transactional updates, idempotent consumers, and reconciliation jobs to detect and fix discrepancies.

5. Optimize and Scale

Address partitioning, caching, read replicas, and handling hot accounts. Consider trade-offs between synchronous vs asynchronous updates.

Key Points to Mention

  • Append-only ledger as immutable source of truth
  • Materialized view for fast balance lookups
  • Event-driven architecture with idempotent consumers
  • Consistency models: strong vs eventual, and reconciliation
  • Partitioning and sharding strategies for scale
  • Caching and read replicas for low-latency reads

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

Q6

How would your ledger handle edge cases like refunds, chargebacks, voids, and multi-leg transfers?

System DesignAdaptability & Ambiguity
Author's notes

Honestly the part I was least prepared for.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints of the ledger system, then propose a double-entry accounting model with immutable entries and compensating transactions to handle edge cases. Explain how each edge case (refunds, chargebacks, voids, multi-leg transfers) maps to specific ledger entries, ensuring consistency and auditability.

Pro tip: Emphasize idempotency and the use of unique transaction identifiers to prevent duplicate processing, a critical aspect in financial systems like Stripe's. Also, mention the importance of handling these edge cases atomically to maintain ledger integrity.

1. Clarify Requirements and Assumptions

Ask questions to understand the scope: What is the expected throughput? Are there regulatory requirements? What is the existing architecture? This shows you consider context before diving into design.

2. Propose a Core Ledger Model

Describe a double-entry bookkeeping system with immutable entries, where each transaction consists of balanced debits and credits. Mention the need for a transaction ID and timestamps for auditability.

3. Map Edge Cases to Ledger Operations

For each edge case, explain the ledger entries: refunds reverse the original transaction; chargebacks create a new debit to a liability account; voids cancel a pending transaction; multi-leg transfers involve multiple balanced entries across accounts.

4. Address Consistency and Idempotency

Discuss how to ensure atomicity (e.g., using database transactions) and idempotency (e.g., idempotency keys) to handle retries and prevent duplicate entries.

5. Discuss Scalability and Monitoring

Mention partitioning, sharding, and how to monitor for discrepancies. Highlight the need for reconciliation processes to detect and correct errors.

Key Points to Mention

  • Double-entry accounting and immutable ledger entries
  • Compensating transactions (reversals) instead of mutating entries
  • Idempotency keys to handle retries and avoid duplicates
  • Atomicity and consistency guarantees (ACID vs. BASE)
  • Multi-leg transfers as a set of balanced entries across accounts
  • Reconciliation and audit trails for detecting and resolving discrepancies

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