#khemprakash_api
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/1362200945093513227
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Wow, that's an excellent question. I have an idea but I need to flesh it out a bit. Give me a second.
What approach are you using for recording usage? Are you using Meters? https://docs.stripe.com/billing/subscriptions/usage-based/implementation-guide#create-meter
yes new meters api
Ok. So a Meter is tied to a [ customer_id, price_id ] pair, so a new price means a new pairing, which which will have a different meter.
That means you'll need to take the unbilled usage from the old meter and add it to the new one.
I can fetch old meter reading and send it to new one but losing previous rate will incur loss on company. Say if they consumed 500 units at $2 that is $1000. If they changed usage half way they will pay less than before
Right. Ok. So you need to make sure you capture the old usage during the proration stuff.
Cool. Give me a sec.
So sorry for the delay.
Prorations only apply to charges that occur ahead of the billing cycle. Usage-based billing isn’t subject to proration.
https://docs.stripe.com/billing/subscriptions/prorations#when-prorations-are-applied
So you'll need to compute that all yourself and add an Invoice Item for that.