#kemara-upgrade-subscriptions
1 messages ยท Page 1 of 1 (latest)
Hmmm. I'll need to think on that. Are the usage items metered? Or do you have a different usage property?
Yes the usage items are metered . (Sorry โ I use usage and metered interchangeably ๐ฌ )
The easiest approach initially seemed to be to delete the existing items on the Subscription and replace them with the upgrading items. However, I found that usage items cannot be deleted if they have usage records associated with them.
Did you run into an error when testing this? I thought that you could delete usage records and useclear_usageto effectively remove any built-up usage onmeteredproducts specifically
Yeah so I was initially sending the request with just the deleted field set to true and got the error saying usage items need to have the clear_usage field set too in order to delete the item. But because the upgrade can happen at any point in the billing period, we need those usage records intact so that they can be charged to the customer at the end of the billing period. And there's no prorated charges for the deleted usage items unlike with the fixed-fee items.
Ahhhh, right. Okay that makes sense. Let me give another quick once-over to your above approaches to make sure nothing blocking/disruptive jumps out at me.
Cool โ thank you ๐
I assume you wouldn't want to bill immediately for the non-upgraded items, right?
E.g. I start a Subscription on June 1st, then upgrade on June 7th and get immediately billed for June 1st-7th
Correct โ we don't want to bill for the non-upgraded items immediately
Okay, so here's what I came up with:
**Approach #1 **is maybe more complicated than the alternatives and I wouldn't recommend without extensive testing on your part. I will be honest and say that I'm not quite 100% sure this will work, though I also can't think of a reason it wouldn't.
**Approach #2 **is fine, but you would essentially have to delete usage records and do calculations on your end (effectively taking a usage record and transforming it into a one-time charge to be added to the next Invoice). Still complicated, but less so.
Alternative:
- Add a new subscription item for the new metered price (do not update the existing subscription item)
- Stop reporting usage for the original subscription item, and report all new usage for the new subscription item
- After the period is over and the invoice has been generated, delete the original subscription item
Thanks for your help ๐ I'll take this info back to the team ๐
After the period is over and the invoice has been generated, delete the original subscription item
Does this mean for us to delete the subscription item via API? Is there any way to automate this on Stripe's end or is that where Schedules come into play?