#zach-wehner_meteredprice-subitem-delete

1 messages ยท Page 1 of 1 (latest)

gilded flareBOT
#

๐Ÿ‘‹ 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.

maiden vaultBOT
silver saddle
#

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?

late void
#

They have 1 subscription

#

multiple subscription items

silver saddle
#

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

late void
#

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

silver saddle
#

When you say "turn off" what do you mean?

late void
#

delete the subscription item

#

and bill them for what usage has been reported thus far at end of billing cycle

silver saddle
#

Okay so they are no longer going to be subscribed to that item?

late void
#

correct

silver saddle
#

And are you able to make an API request and get back an error?

late void
#

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

silver saddle
#

Can you share the request ID?

late void
#

and the api documentation does not tell me much

#

yes 1 sec

#

req_MsteMZDXzErPH7

silver saddle
#

Thanks, taking a look

late void
#

thank you

silver saddle
#

Do you want to bill immediately for the existing usage?

late void
#

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

silver saddle
#

I realize that we default to create_prorations but could you try passing in the proration_behavior='create_prorations' parameter?

late void
#

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')

silver saddle
#

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

late void
#

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

silver saddle
#

I'm checking with my colleagues

late void
#

thanks

silver saddle
#

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.

late void
#

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?

silver saddle
#

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.

late void
#

is there a way to bill the usage immediatley then, before clearing it?

silver saddle
#

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.

late void
#

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...

silver saddle
#

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

late void
#

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

silver saddle
#

just bill it at end of billing cycle
I think that is what we need the Subscription Item in order to do

late void
#

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

silver saddle
#

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.

late void
#

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.

silver saddle
#

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

late void
#

please do, it seems like a reasonable request

silver saddle
#

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

late void
#

thanks

silver saddle
#

Happy to shed what ๐Ÿ’ก I can ๐Ÿ™‚