← Stripe Interview Insights

Stripe·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Jun 2026Remote

Summary

Stripe data engineer interview with a meaty CSV parsing and fee aggregation problem. The question looks like a glorified ETL task but there's enough edge cases baked in that you can easily spiral if you're not careful about how you structure it.

Questions Asked (1)

Q1

Given a CSV string of payment transactions and several lookup dictionaries (base rates by provider, completed rates by provider and country, and FX conversion factors), write a function that computes the total processing fee per merchant and returns the result as a CSV string. Walk through your fee calculation logic, fallback handling for missing keys, and how you'd test edge cases like empty input, malformed rows, or unknown currencies.

Algorithms & Data StructuresTechnical Trade-offsAPI & Integrations
Author's notes

This took me longer to parse (no pun intended) than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the input format, fee formula, and fallback rules before writing any code. Then outline a pipeline: parse CSV, validate rows, compute fees using lookups with fallbacks, aggregate per merchant, and serialize to CSV. Finally, discuss edge cases and testing strategy.

Pro tip: Mention that you'd use Decimal for monetary calculations to avoid floating-point errors, and that you'd log or flag rows with missing lookups for observability rather than silently defaulting.

1. Clarify requirements and assumptions

Ask about the exact fee formula, the structure of the lookup dictionaries, and the expected fallback behavior for missing keys. Confirm the output CSV format (columns, ordering, rounding).

2. Design the parsing and validation layer

Parse the CSV string into rows, validate required fields (e.g., merchant_id, provider, country, amount, currency), and decide how to handle malformed rows (skip, error, or log).

3. Implement fee calculation with fallbacks

For each valid row, look up the base rate by provider, the completed rate by provider and country, and the FX factor by currency. Apply fallbacks: if completed rate missing, use base rate; if FX missing, use 1.0 or skip with a warning.

4. Aggregate and serialize results

Sum fees per merchant using Decimal arithmetic, then format the output as a CSV string with headers and sorted merchant IDs for determinism.

5. Test edge cases and explain trade-offs

Walk through tests for empty input, malformed rows, unknown currencies, and missing lookups. Discuss trade-offs like strict vs. lenient fallbacks and performance considerations.

Key Points to Mention

  • Use Decimal for monetary calculations to avoid floating-point precision issues.
  • Define clear fallback rules: e.g., if completed rate is missing, fall back to base rate; if FX factor is missing, treat as 1.0 or flag as error.
  • Validate input rows and decide on error handling: skip malformed rows with logging, or fail fast depending on requirements.
  • Aggregate fees per merchant using a dictionary or hash map, then sort keys for deterministic output.
  • Test edge cases: empty CSV, missing headers, malformed rows, unknown currencies, and missing lookup keys.
  • Consider performance for large inputs: streaming vs. in-memory processing, and time complexity O(n) where n is number of rows.

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