← Questions
Subscription billing with proration and tiered usage
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Build a small billing engine that produces each user's charge for one 30-day cycle. Amounts are in cents, and the final charge per user is rounded down only once, at the end.
- Every user has one or more fixed-price subscriptions. Return each user's monthly total.
- Users change plans part-way through the cycle. Prorate: charge the old price for the days before the change and the new price for the rest.
- Add usage-based billing. Some metered items have a flat price per unit; others are tiered, where each block of units has its own price. A user may have usage without any subscription.
Each part builds on the one before, so structure the code to be extended.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
