Design A Team Purchase Service With Expiring Groups And Refunds
Last updated: November 29, 2026
Quick Overview
Design the service that lets a user open a team-purchase group at a discounted price, share it with friends, collect paid joins until the group is full, and automatically refund everyone if the group does not fill within 24 hours.
Pinduoduo
November 29, 20260
0
0 solved
Design the service that lets a user open a team-purchase group at a discounted price, share it with friends, collect paid joins until the group is full, and automatically refund everyone if the group does not fill within 24 hours.
Group buying is the mechanic Pinduoduo was built on, so the interviewer expects a clean state machine, reliable timers and correct money movement rather than just boxes. They will probe races at the moment a group fills, how millions of deadlines fire on time, and how refunds stay exactly-once.
What the Interviewer Expects
- Defines the group and member state machine explicitly
- Pays at join time and handles the last-seat race atomically
- Uses a scalable timer mechanism for deadlines
- Makes refunds idempotent and reconciled with the payment provider
- Discusses auto-matching shoppers into open groups
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- Two users pay for the last seat at the same time. What happens to the loser?
- How would you let strangers auto-join an open group for the same product?
- How do you support a merchant cancelling the product while groups are open?
- Which metrics would you alert on?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Create group (leader pays), join group (member pays), share link, view group status, complete group (trigger order fulfillment), expire group (refund all). Scale: tens of millions of groups per day, e...
High-Level Design
Services: Group Service (owns groups and members in MySQL sharded by group_id), Payment Service, Order Service, Timer Service, Notification Service, and an event bus (Kafka). Group states: OPEN, FULL,...