Enforce Dispute Lifecycle Transitions and Evidence Deadlines

Last updated: November 29, 2026

Quick Overview

Process a time-ordered stream of dispute events (create, submit evidence, accept, escalate, close inquiry, issuer decision) and track each dispute's status. Reject events that are not valid from the current status, auto-lose chargebacks whose evidence deadline passed, and report final statuses plus rejected events.

Stripe
Coding & Algorithms
Software Engineer
Stripe
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Process a time-ordered stream of dispute events (create, submit evidence, accept, escalate, close inquiry, issuer decision) and track each dispute's status. Reject events that are not valid from the current status, auto-lose chargebacks whose evidence deadline passed, and report final statuses plus rejected events.

Disputes on Stripe move through statuses such as `needs_response`, `under_review`, `won` and `lost`, with inquiries (`warning_*` statuses) that may escalate into chargebacks, and missing the evidence deadline loses the dispute. The interviewer checks that you model the lifecycle as an explicit transition table, enforce time rules in one place and keep invalid input from corrupting state.

What the Interviewer Expects
  • Represent valid transitions as data, keyed by `(status, event)`
  • Apply the deadline rule lazily before handling each event, plus a final sweep at a given `now`
  • Reject, and record, events for unknown disputes or invalid transitions without mutating state
  • Treat terminal statuses (`won`, `lost`, `warning_closed`) as accepting no events
  • Keep the processor deterministic for replay from an event log
Key Topics to Cover
state machines
simulation
event processing
deadlines
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you notify the merchant a few days before the deadline?
  • How would you handle an issuer decision that arrives before evidence is marked submitted?
  • How would you make this safe when two workers process events for the same dispute?
  • How would you add a reversal after a dispute is won?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Events are tuples (ts, dispute_id, kind, data), sorted by ts. create carries {"type": "inquiry" or "chargeback", "due_by": int}; escalate carries a new due_by. Evidence must arrive at or b...

High-Level Design

A TRANSITIONS dict maps (status, event) to the next status, which makes the lifecycle reviewable at a glance and keeps validation to one lookup. Before handling any event for a dispute, call `_exp...


Submit Your Answer
Markdown supported