Preparing your design workspace

Loading the problem and your latest saved attempt…

Design Chargeback Ingestion and Eligible-Record Export

Design a chargeback pipeline that validates and deduplicates records, tracks eligibility, and delivers retry-safe CSV batches over SFTP.

Problem statement

For this exercise, assume upstream card-processing systems continuously submit chargeback and dispute events with a stable network case identifier, event version, and event timestamp.

The platform validates each event, deduplicates retries, preserves corrections in an auditable state history, and evaluates versioned eligibility rules. Eligible current records are placed into periodic bounded CSV batches and delivered to Mastercard over SFTP.

Each batch has a stable identity, deterministic contents, a digest, and one remote filename; if a transfer or acknowledgement is ambiguous, the system must reconcile the remote artifact before retrying rather than sending a logically duplicate batch.

Operators need to inspect record and batch state, quarantine invalid input, retry eligible failures, and prove which record version appeared in which file. Fraud detection, payment authorization, dispute adjudication, and Mastercard's internal processing are outside scope.

What to build

  1. Upstream systems can idempotently submit versioned chargeback events and receive accepted, duplicate, invalid, stale, or retryable outcomes.
  2. Authorized operators can inspect each case's versioned processing state, validation evidence, eligibility decision, and immutable audit history.
  3. The platform periodically freezes eligible record versions into bounded CSV batches with stable identities, deterministic contents, and digests.
  4. The platform sends each batch to Mastercard over SFTP, reconciles ambiguous outcomes, and exposes delivered, pending, retryable, quarantined, or failed status.

At scale

  • For this exercise, assume 50 million chargeback events per day with bursts of 10,000 events per second, and no CSV may contain more than one million records or exceed 2 GiB.
  • For this exercise, durably acknowledge 99% of valid events within one second and make their authoritative state queryable within 30 seconds.
  • For this exercise, freeze an export batch every hour and deliver 99% of eligible records within two hours of eligibility, while a Mastercard outage may last 24 hours.
  • For this exercise, retain raw inputs for 90 days and record, rule-version, batch-manifest, transfer-attempt, digest, and audit evidence for seven years; accepted data must survive a worker or single-zone failure.