Desgin something like stripe subscriptions https://stripe.com/docs/billing/subscriptions/overview
Assumptions:
- this is a service that can handle 10M DAUs
- users are billed uniformly throughout the month based on when their subscription was created (every 30 days after signup)
- must be able to handle partial billing (user cancelled subscription halfway through a month)
- must send error email to user if their credit card fails to charge
- must send email if credit card is about to expire/has expired
- after error handles retries correctly with new payment method
- support free trails (7,14,n days)
- support promotion codes (coupons)
- collect sales tax based on customer's state tax (usa)