Sending Subscription Notifications — Part 1
At Stripe, we frequently send notifications to users related to their subscriptions.
Each user has an account creation date and a subscription plan with a specific duration.
You’ll need to generate email subject lines corresponding to each user for different stages of their subscription, sorted by time.
Your notification system will need to allow the configuration of a send schedule.
For example, a send schedule configuration might be:
- send one email on the account creation date,
- another email 15 days before the subscription end date,
- and a final email on the subscription end date.
The send schedule could look like this:
t=start [Welcome] New subscription for ${user}
t=15 days before end [Upcoming expiry] Subscription expiry upcoming for ${user}
t=end [Expired] Subscription end for ${user}
Given a send schedule configuration, your input will be an unsorted list of user accounts with:
- account creation date
- subscription duration in days
- user name
- subscription plan
Your objective is to print out all email subject lines we will send out, sorted by time.
The output should include the time, type of email, the user, and the plan.
Example configuration:
send_schedule = {
"start": "Welcome",
"-15": "Upcoming expiry",
"end": "Expired"
}
user_accounts = [
{"account_date": 0, "duration": 30, "name": "John", "plan": "Silver"},
{"account_date": 1, "duration": 15, "name": "Alice", "plan": "Gold"},
]
Expected output:
0: [Welcome] Subscription for John (Silver)
1: [Welcome] Subscription for Alice (Gold)
1: [Upcoming expiry] Subscription for Alice (Gold)
15: [Upcoming expiry] Subscription for John (Silver)
16: [Expired] Subscription for Alice (Gold)
30: [Expired] Subscription for John (Silver)
Sending Subscription Notifications — Part 2
Sometimes users may change their subscription plan during the subscription period.
You are now given a list of subscription changes, each specifying the time of change, user name, and new plan.
Each subject line should reflect the user’s current plan at the time of sending.
Additionally, when a plan is updated, send an“[Updated]”notification email immediately.
Example:
subscription_changes = [
{"change_date": 5, "name": "Alice", "new_plan": "Platinum"}
]
Expected output:
0: [Welcome] Subscription for John (Silver)
1: [Welcome] Subscription for Alice (Gold)
1: [Upcoming expiry] Subscription for Alice (Gold)
5: [Updated] Subscription for Alice (Platinum)
15: [Upcoming expiry] Subscription for John (Silver)
16: [Expired] Subscription for Alice (Platinum)
30: [Expired] Subscription for John (Silver)
The problem simulates Stripe’s subscription notification system.
It requires implementing a program that can send notification emails at specific time points — such as the account creation date, N days before the subscription end date, and the subscription end date itself.
Each user has: an account creation date, subscription duration, user name, and subscription plan.
The system must generate corresponding email subject lines based on the configuration and output them in chronological order.
In the second part, the problem introduces subscription plan changes that occur during the active period.
The system must immediately send an“[Updated]”notification upon plan change, and all subsequent emails should reflect the new plan.
Key focus areas:
- Event scheduling and time-based ordering
- Merging multiple data sources (user info + plan updates)
- Dynamic state updates (plan change propagation)
- Modular and scalable system design
The VOprep team has long accompanied candidates through various major company OAs and VOs, including Stripe, Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for Stripe or similar engineering-focused companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.