#5thirty5_api

1 messages ยท Page 1 of 1 (latest)

tame tendonBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

dreamy flame
#

There's not going to be a straightforward way to do this unfortunately. Proration behavior isn't customizable. There's some workarounds you could employ though. When the customer upgrades or downgrades their subscription, are you also wanting to reset the billing cycle anchor? And if not, are you wanting to invoice immediately for the upgrade or downgrade?

unborn cargo
#

yes i want to invoice immediately for both downgrade and upgrade. the billing cycle always stays the same ending at the end of the month and new cycle starts on the 1st of each month

dreamy flame
#

Ok got it. So to achieve this, you'd update the subscription with the new price, deleting the old one, while also passing proration_behavior=none. This will ensure that the new price will be charged without prorations at the next billing cycle.

Now, to invoice for the upgrade or downgrade immediately with your custom proration behavior, you'd create invoice items for the customer (tied to the subscription id) for the items and prorations you want to invoice them for: https://docs.stripe.com/api/invoiceitems/create#create_invoiceitem-subscription

Then, you'd create an Invoice ad-hoc tied to that Subscription id to invoice the customer for those manually created subscription items: https://docs.stripe.com/api/invoices/create#create-subscription

This would require you to either calculate the prorations manually or to use the invoice preview api to see what the prorated amount would be for an update that invoiced the customer immediately: https://docs.stripe.com/invoicing/preview

unborn cargo
#

ok so basically i have to do the same thing i was doing for the downgrade, but for the upgrade. for the calculations do i pull the previous invoice and calculate based off of that?

dreamy flame
#

Yeah

#

Or use the data from the invoice preview api to do it for you

unborn cargo
#

ok thank you, i'll try this now

#

question about the metered item. i have a flat fee and a metered item on my invoices. after i upgrade or downgrade, will i still be able to post the metered usage to those invoices?

dreamy flame
#

So you want the metered usage appended to the new invoice, not the next billing cycle's?

unborn cargo
#

we calculate metered usage daily and would post it to stripe, I am trying to figure out how that would work for a downgrade or an upgrade case where the previous metered item is removed and a new one is added. When posting to stripe would it be possible to still post metered usage to the previous subscription line item due to a 1 day delay

dreamy flame
#

Ok behavior here is going to depend on a number of factors

tame tendonBOT
turbid hornet
#

๐Ÿ‘‹ it's been some time since we've heard back, i'll be closing out the thread but if you have any follow up questions or concerns please don't hesitate to reach out.