Design a Scratch Card Rewards Engine with Hard Budget Caps

Last updated: November 29, 2026

Quick Overview

Design the backend that decides, right after a qualifying payment, whether a PhonePe user wins a scratch card and how much cashback it holds, while never exceeding each campaign's daily budget across millions of concurrent payments.

PhonePe
System Design
Software Engineer
PhonePe
November 29, 2026
Software Engineer
System Design Round
System Design
Medium

0

0

0 solved


Design the backend that decides, right after a qualifying payment, whether a PhonePe user wins a scratch card and how much cashback it holds, while never exceeding each campaign's daily budget across millions of concurrent payments.

Cashback and scratch cards are a major acquisition and engagement lever for PhonePe, and overspending a campaign budget during a festival spike is real money lost. The interviewer checks how you keep rewards off the payment critical path, enforce a global budget without a single hot counter, and stop abuse.

What the Interviewer Expects
  • Decouple reward evaluation from payment success via events
  • Express campaign eligibility as configurable rules, not code
  • Enforce budget with pre-allocated chunks instead of one global counter
  • Make reward grants idempotent per transaction
  • Address abuse: self-transfers, rings of accounts, refunded payments
Key Topics to Cover
event-driven design
rule engine
distributed counters
idempotency
fraud prevention
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • A campaign must give a 'guaranteed' reward on a user's first bill payment. How do you guarantee it under budget exhaustion?
  • How would you run an A/B test on reward amounts inside this engine?
  • What happens to an unscratched card whose payment is refunded?
Sharpen Your Skills on Codemia

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

Practice System Design Problems
Sample Answer
Requirements

Inputs: payment success events with user, merchant category, amount, instrument. Campaigns define eligibility (category, minimum amount, new vs existing user, caps per user), a reward distribution (fo...

High-Level Design

Payments publish PaymentSucceeded to Kafka. A Rewards Evaluator consumes events, loads active campaigns from a cached config store, filters by eligibility and per-user caps (counters keyed by user a...


Submit Your Answer
Markdown supported

Related Questions