Payment Records & Billing
- Reconcile payments to invoices by memo, then by amount and earliest due date, then within a forgiveness tolerance
- Validate transaction CSV rows with a real CSV reader and give each row exactly one status code
- Link merchant records by weighted score, with a hop limit and then full connected components
- Schedule welcome, reminder and expired emails from subscriptions and a send schedule, then handle renewals
- Practice two older tasks: a graduated pricing ladder and a chargeback parser
These six tasks hand you money records. The first four are what candidates describe from 2025 and 2026 screens and onsites: invoice reconciliation, transaction CSV validation, linked-merchant matching and an email subscription scheduler. The last two, a shipping-cost pricing ladder and a chargeback parser, come from 2024 and 2025 reports and still make good practice. Two habits carry across all six. Hold money in integer cents, the way Stripe's own API does, and sort output by an explicit key so it matches the expected results exactly. Then read the rules slowly, because each task hides an edge case in them, like two payments claiming one invoice or a reminder that would land before a subscription starts.
The method for running the round, from restating the spec to writing your own tests, is in Practical Coding.
Asked at Stripe
Invoice and Payment Reconciliation: Match Both Sides
Problem
"id". Each payment is a dict with its own "id" and a reference to the invoice it pays: either an "invoice_id" field, or, when that is missing, a "memo" string that carries the invoice id.Match each payment to an invoice by that reference. Return three things: the matched
(invoice_id, payment_id) pairs, the invoice ids that no payment matched, and the payment ids that matched no invoice. If two payments both point at the same invoice, only the first one matches and the rest are unmatched. Sort each list so the output is deterministic.pay_a references inv_2 directly. pay_b has no invoice_id, so its memo "inv_1" is used and matches inv_1. pay_c references inv_9, which does not exist, so it is unmatched. inv_3 had no payment.
Index, then sweep. Build a dict from invoice id to invoice so a reference is an O(1) lookup. Sweep the payments: resolve each reference (invoice_id, else memo), and if it points at a not-yet-claimed invoice, record the match and mark that invoice claimed. Everything left over is unmatched on its respective side.
Invoice and Payment Reconciliation: Match Both Sides
Click "Run" to execute your code
Transaction CSV Validation: Flag Bad Rows, Then Apply the Rules
Problem
transaction_id,customer_id,amount,currency,payment_method,timestamp. The amount should be a whole number of cents.Return one status code per data row, in input order. A row with a missing or empty field gets
MISSING_FIELD. Otherwise, an amount that is not a positive whole number no larger than max_amount gets INVALID_AMOUNT. Otherwise, a payment method in blocked_methods (compared case-insensitively) gets BLOCKED_METHOD. Everything else is OK.Check the rules in that order, so each row gets exactly one code.
The first row passes every rule. An empty amount stops tx2 at the first rule. Both tx3 (over the 100000-cent cap) and tx5 (negative) fail the amount rule, and tx4 is well formed but pays with a blocked method.
Parse, then run each row through an ordered list of checks and stop at the first that fails. Read the text with a real CSV reader, strip the fields, test for empties, then the amount, then the payment method. The order of the checks is part of the spec, because it decides which code a row with two problems gets.
Transaction CSV Validation: Flag Bad Rows, Then Apply the Rules
Click "Run" to execute your code
A close cousin showed up in team screens from late 2025 into August 2026: validating business (KYC) records from a CSV. Reported parts check required fields, a length of 5 to 32 characters and banned words, then whether the business name shares words with a second name field once suffixes like LLC and Inc are ignored. It is the same rule ladder with different rungs. Older new-grad assessments, back in 2024, used a simpler card-transaction cleanup: drop the declined rows and sort the rest.
Merchant Record Dedup: Weighted Match, Then Link the Clusters
Problem
id, a name, an email, and a company.Part 1. Score every pair of records for how likely they are the same entity. A shared, non-empty
email is worth 3 points, a shared name is worth 2, and a shared company is worth 1. Compare fields case-insensitively after trimming whitespace, and count a field only when both records carry it. Return the pairs that score at or above a threshold, each as (id_a, id_b, score) with id_a < id_b, sorted.Part 2 (the escalation). Treat every matching pair as an edge and return the connected components: the groups of records that all describe one real entity. A record that matches nothing is its own group of one. Sort the ids inside each group, then sort the groups. The catch is transitivity. If A matches B on email and B matches C on name and company, then all three are one entity even though A and C share nothing directly.
Records c1 and c2 share the email jane@acme.com, so they link. Records c1 and c3 share a name and a company, so they link too. On their own, c2 and c3 never match, yet both ride into c1's group through those links. Finally, c4 and c5 are a clean duplicate across all three fields.
Score first, then link. The scoring pass is a double loop over the records that adds field weights for each pair, and that is the disguised part: the pairs that clear the threshold are edges in a graph. The second part is connected components over that graph. Union-find each matching pair, or run a DFS or BFS from every unvisited record. Either approach handles transitivity, which is exactly what a naive pairwise grouping drops.
Merchant Record Dedup: Weighted Match, Then Link the Clusters
Click "Run" to execute your code
The same union-find shape ran as a July 2026 online assessment, in the timed 60-minute HackerRank format: one long problem whose parts open one after another, graded by hidden tests. Customers who share a device id form a fraud ring. A later part links on device or card and asks for the largest ring, and the last part averages the ring's risk scores with zero-risk members left out.
Email Subscription Scheduler: Welcome, Reminder, Expired
Problem
name, a plan, a begin day and a duration in days, so the subscription ends on day begin + duration. A send schedule lists the emails and when each one fires: "start", "end", or a negative number of days counted back from the end.Return every email as
(day, message, name, plan), sorted by day. Emails on the same day keep the order of the users, then the order of the schedule. Skip any reminder that would land before the subscription begins.A ends on day 30, so its reminder fires on day 15. B ends on day 16, so its reminder lands on day 1, the same day as its welcome. On day 1 the welcome comes first because it comes first in the schedule.
Expand, then sort. For each user, turn every schedule entry into a concrete day: the begin day, the end day, or the end plus a negative offset. Drop the ones before the begin day, collect the rest as tuples, and sort by day with a stable sort so same-day emails keep their order.
Email Subscription Scheduler: Welcome, Reminder, Expired
Click "Run" to execute your code
Older problems, still good practice
The pricing ladder was a 2025 screen task, and the chargeback parser came from a 2024 new-grad online assessment. Neither has a recent report, but both drill the same parsing and money habits, so work them after the four above.
Shipping-Cost Pricing Ladder: Flat, Per-Unit, Then Tiered
Problem
;, and each tier reads UP_TO:FLAT:PER_UNIT, three fields split by colons. UP_TO is the cumulative unit ceiling for the tier, or * for the final unbounded tier. FLAT is a one-time fee in cents that applies when any unit falls in the tier, and PER_UNIT is the per-unit price in cents for units inside it.Part 1. Start with a single rate: one flat base fee plus a per-unit charge. Given a flat fee together with a per-unit price and a quantity, return the cost in cents, which is
flat + per_unit * quantity, and 0 when the quantity is 0.Part 2 (the escalation). Price the full graduated ladder. Walk the tiers in order, charging the units that fall inside each bracket that bracket's per-unit rate. A bracket's flat fee is added only when at least one unit lands in it. Return the total cost in cents for a given quantity. Model the parsed ladder as a list of
(up_to, flat, per_unit) tiers, with up_to the ceiling or None for the unbounded tier.A single tier: a 500-cent base fee plus 120 cents per unit. For 4 units, 500 + 120 * 4 = 980 cents.
Parse first, price second. Split the spec into UP_TO:FLAT:PER_UNIT tiers kept in order, with the final "*" tier unbounded. The first part reads one tier and charges flat plus per-unit times quantity. The second part walks the tiers, charging the units that fall inside each bracket at that bracket's rate and adding a bracket's flat fee only when a unit lands in it. Track a running lower boundary so every unit is billed exactly once.
Shipping-Cost Pricing Ladder: Flat, Per-Unit, Then Tiered
Click "Run" to execute your code
tiers_mode works the same way. Keep every amount in integer cents and an honest running lower boundary, or a total lands a few cents off.Chargeback Parser: Aggregate and Flag
Problem
MERCHANT|CASE_ID|AMOUNT|OPENED_DAY|RESPONDED_DAY. AMOUNT is an integer number of cents the cardholder disputed. OPENED_DAY is the day the dispute opened, and RESPONDED_DAY is the day the merchant submitted evidence, or "-" if the merchant never responded.Part 1. Total the disputed amount per merchant, returned as
(merchant, total_cents) pairs sorted by merchant.Part 2. A merchant has
deadline_days to respond before the dispute auto-resolves against them. Flag every case whose response landed too late, meaning RESPONDED_DAY - OPENED_DAY is strictly greater than deadline_days. A record that never responded ("-") always counts as past the deadline. Return the flagged case ids sorted, alongside the per-merchant totals.Merchant acme disputed 1500 + 800 + 450 = 2750, and globex 2000. Record cb_2 responded on day 25 against an open of day 10, so 15 days, past the 7-day deadline. Record cb_3 never responded, so it is flagged. Records cb_1 (2 days) and cb_4 (1 day) are within the window.
Parse, aggregate, flag. Split the string on semicolons, then split each record on the pipe into five fields and turn the cents and days into ints. Sum the amounts into a per-merchant dict. For the deadline, treat a "-" response as always late, otherwise compare responded minus opened against the deadline. Sort both outputs so the result is deterministic.
Chargeback Parser: Aggregate and Flag
Click "Run" to execute your code
"-" as late before any int() call touches it.Key Takeaways
- ✓Reconciliation is an index plus a claimed set: memo first, then amount by earliest due date, then a forgiveness tolerance.
- ✓Validate CSV rows with a real CSV reader and check the rules in a fixed order, so every row gets exactly one code.
- ✓Linked merchants is a graph problem: pairs over the threshold are edges, and a hop limit is a depth-capped breadth-first search.
- ✓The email scheduler is day arithmetic plus a stable sort. Renewals lengthen the input; plan changes relabel the output.
Stripe interview guideKnow what Stripe asks before you walk in.
16 coding · 6 system design · 31 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.