#zach-wehner_meteredprice-subitem-delete
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1221860403894685758
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
I'm sorry I'm not quite clear on what you are trying to do here.
You want to allow a Customer to change what about their subscription?
Usage records are meant to be used to record usage that has occurred so I'm not sure why you would want to clear the usage
they will turn on and off subscription items
i do not want to clear the usage
i want to turn off 1 of the subscription items
but when i call stripe.SubscriptionItem.delete
When you say "turn off" what do you mean?
delete the subscription item
and bill them for what usage has been reported thus far at end of billing cycle
Okay so they are no longer going to be subscribed to that item?
correct
And are you able to make an API request and get back an error?
yes
'When deleting the subscription item XXX with a metered plan, all related usage records must be cleared too by setting clear_usage=true.'
this is what i am confused on
Can you share the request ID?
Thanks, taking a look
thank you
Do you want to bill immediately for the existing usage?
no
i want at the end of the month to have the 1 invoice against this subscription showing they usage they used up to this point
I realize that we default to create_prorations but could you try passing in the proration_behavior='create_prorations' parameter?
sure
let me try
same error
InvalidRequestError(message='When deleting the subscription item si_PmmZyOKkGF4aaL with a metered plan, all related usage records must be cleared too by setting clear_usage=true.', param=None, code=None, http_status=400, request_id='req_MJr6orHPZY4nPK')
Okay and if you use always_invoice does that fail the same way? Sorry for asking you to jump through all these hoops but I've got a few threads to juggle
no worries
InvalidRequestError(message='When deleting the subscription item si_PmmZyOKkGF4aaL with a metered plan, all related usage records must be cleared too by setting clear_usage=true.', param=None, code=None, http_status=400, request_id='req_J8ErTKVrDgUkXr')
same failure
I'm checking with my colleagues
thanks
Okay, so for a Subscription Item with a metered price, it is expected that you would not delete it until the the end of the billing period. The idea being that, even if the Customer does not want that item any more, you still plan on billing them for the accumulated usage. So you would need to keep track of which item to delete and perform that action after the billing cycle when the usage resets.
hmm, that seems less than ideal ๐
why wouldnt the subscription item just be turned off and then when billing time comes around that usage be added to the bill?
I don't know the exact reasoning but my interpretation would be that the SI represents the item to be billed at the end of the billing cycle. Deleting it would remove that source of data. That would explain why we require you to clear the usage if you want to do it.
is there a way to bill the usage immediatley then, before clearing it?
You could create a one-off Invoice item for the cost of the usage so far. Then delete and clear the usage on the Subscription Item. You could generate a one-off invoice. But that might be a pain to reconcile with the Subscription itself in your financial reporting.
yea in general keeping track of what to delete then doing it at end of the billing cycle is pretty painful
im just suprised this is not somethign other customers are seeing as odd. I would think u give the option to not clear usage, just bill it at end of billing cycle...
I guess. But metered usage prices only bill for recorded usage. So just not creating any new usage records has the effect of not charging the Customer for the item
it does, but the customer wants to see what subscriptions they have
so now i have to have a mechanism to not show them this subscription even though its active in the system
the system being stripe
just bill it at end of billing cycle
I think that is what we need the Subscription Item in order to do
yea but you would think u would bill the subscriptiion items which have been deactivated
at the end of the billing cycle as well
and for those who dont want to do that, they would be the ones needing to clear usage with this flag
What I am saying is, if we delete the Subscription Item that is related to the Usage Records, we would not have the data to know how much to bill the Customer at the end of the billing period.
Becuase the existence of that Subscription Item is where we get that data from.
yea, shouldnt hard delete the subscription item, soft delete it, until the next billing cycle is over then hard delete. Usage happened, if someone cancels a usage based subscription i dont think many people want to say, hey even though you used this much this month, we dont want to charge you.
True. I can raise this as a feature request for our billng APIs. I don't know if/when the team will be able to consider it but I can make your interest in the feature known
please do, it seems like a reasonable request
Filed
If you wish to be kept up to date regarding this request you can write in to Support asking to be informed of any updates: https://support.stripe.com/contact
However, once again, I cannot guarantee if this feature will be selected for development
thanks
Happy to shed what ๐ก I can ๐