#alalva_subscription-proration
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/1288553886902259916
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- alalva_api, 1 hour ago, 18 messages
I'm including a couple pictures next
alalva_subscription-proration
the picture shows how the user is enrolled in a $500 membership (regular price $1000) after the 1st year they will pay $1000. The plan to the right called "Custom" allows the user to add more users, admins or locations, by values shown are the values that they currently have within the $500 plan. If the user requests 1 more location then it will show a popup and tell the user the cost to add that location (providing a proration value) and this does work and will also provide the user the annual cost after the 1st year - i'll provide a picture after
this picture shows the user the cost to upgrade a location and also shows the annual cost after the 1st year. What i need to do is give stripe the new amount to charge in this case $22.42 and from there subscribe them to the new plan.
When the user clicks on Charge - it takes the user to Stripe and doesn't discount the fact the user already paid for a previous plan of $500 - will send a picture after
I don't really follow what you mean but it's more because that's not really the right way to debug proration.
What is the problem. When you change the quantity like 1 to 2, what exactly do you see versus what you expect? Don't add 25 users and 6 locations, just change the quantity from 1 to 2 and look at the exact results
\
What is that picture from though? The picture doesn't make sense to me, it looks like Checkout which would make no sense in an upgrade flow as Checkout can only be used to create a brand new Subscription
let me try to explain.
1st We are offering new users a 50% discount on all paid plans, in this case we will use the $1000 plan ( discounted at 50%) now $500
please pause
I am only focusing solely on your upgrade flow. Not creating a brand new Subscription. Can we solely speak about that one specific thing?
2nd the user, in the sure
what?
sure
Okay so you have a $1000 Price, they have a 50% coupon, they pay $500 for a year and are all set.
Then you are trying to upgrade. What's the exact issue?
The user is signed up to that $500 plan and now decides that they need more locations so the next plan which is the Custom Plan allows the user to customize a plan that works for them, therefore if they click on Locations and add 1 user, they will receive a popup. This popup will show the user for the cost of 1 more location we can upgrade you for price of .... and this popup will also show them the annual price after the year. The problem that i'm having is taking the user to a checkout where it can show the upgrade price for that 1 location that they want to add and not try to charge for half of full price of new membership. I want Stripe to account that the user has already paid for a previous subscription within the year and apply that to the new subscription. Hopefully this helps.
The problem that i'm having is taking the user to a checkout where it can show the upgrade price for that 1 location
You are supposed to build that UI/upgrade flow. I think that's the confusion here. You are sending them to Checkout which is definitely incorrect and will never work
I am struggling to understand the pictures. I',m sure they make sense to you but they don't to me and I'm trying to focus solely on the exact API requests you are calling to help you.
I recommend you pause and carefully read https://stripe.com/docs/billing/subscriptions/prorations end to end first.
You seem to already partly understand proration but you don't explain where that $22.42 could come from in your picture
each of the Admins, locations, users all have a price per, the price for the locations is $45 but since we are doing 50% off the price would be $22.50 minus prorations in this case the popup attached shows the user the cost to upgrade to the next plan that will allow the user to add an addition location. The proration is working fine. I'm just trying to figure out what the best way for me to charge the user an amount in this case $22.42 and then upgrade them to the Custom plan. Seems that the checkout session isn't what i should be using and thats fine, I just want to know what the best way for me to charge an amount and upgrade them to the new plan.
You are supposed to update the Subscription and decide if you want to invoice them immediately for the proration using proration_behavior this is covered in https://docs.stripe.com/billing/subscriptions/upgrade-downgrade
copy, i was using the "update the subscription" call prior to checkout session but this call also only allows me to send a "price id" which would mean the full price of the plan not accounting that the user already paid for $500 from a previous plan.
That's not really how it works. I think you mostly misunderstood the whole thing unfortunately. That's why I gave the exact docs links so that you can carefully read them a few times.
My gut says you haven't yet understood proration. You said "proration works fine" but I'm assuming it doesn't and you made your own proration math which is not at all how our own proration will work
i did my own math and when i compare it to the portal it matches the proration identical to what Stripe would charge. I'm also following the math that i received from Stripe discord on how to create a proration
I don't really know what we gave you before unfortunately. I'm trying to ask for exact specific information. Not about your UI. But about the exact API request(s) you are making.
So please, show the exact code that gets you that exact proration
Once I figure out where you are at with this part I'll show you how to update the Subscription
(also if you use the Portal, why were you on Checkout? I feel like I'm missing a ton of useful context)
the reason i'm not using the portal is because i'm creating a custom plans and the portal doesn't allow you to create custom plans on the fly since it needs a product code
The Portal definitely lets you do that
With my custom plan i'm allow the user to sign up to a custom plan and if tomorrow they need addition users or location or admins they can continue to upgrade, and unfortunately the portal doesn't allow you to do this.
You can create a Price and Product and then create a Configuration for it right? https://docs.stripe.com/api/customer_portal/configurations/create
But okay let's focus on one unoque problem otherwise this will never work.
So please, share the proration code specifically
i'm trying to get the thread from previous conversations on the proration formula
I don't want any formula to be clear
I'm sorry, I'm really trying to help you here understand how proration works. IF you do your own math, it'll never work the way it should and you're approaching this quite wrong (which might be what we told you but that was wrong)
I'm helping you with code related to our API. I'm solely focusing on our API. We offer a way to preview proration and to calculate it. That's what you should use
i'm using "Retrieve an upcoming Invoice" on this call i'm providing the Customer, the Subscription, "create_prorations, subscription_items_price, subscription_items_id and subscription_proration_date
i appreciate your help! i truly do and i will change anything need to make it work.
Okay, please share the exact code. I'm not doing this to be annoying, I'm doing to show you how it works
i'm using Bubble which is a no code platform -
i'm using bubble which is a no code platform, i don't think it can show me the code.
Sadness, this explains a lot ๐
This is going to be much harder because that isn't real code
i'll read thru the documents & see if i can understand this better.
So that second picture is calling the Retrieve Upcoming Invoice API https://docs.stripe.com/api/invoices/upcoming and passing parameters to "simulate" what the Invoice would look like if you changed the Subscription. Do you understand that part?
So that API mirrors what you would pass to the Update Subscription API https://docs.stripe.com/api/subscriptions/update to make the changes you previewed, but for real
So now you need to call that API and pass similar parameters. I assume Bubble has a UI for that exact flow
I can't really debug a picture I'm sorry. Their UI is impossible to understand (for me)
i'm using that call right after the user clicks on pay. This call is update a subscription, the first one is asking for the Subscription id, then the Stripe id for payment and the proration date in unix
We're back to "what is the exact issue". Sorry it's been quite a while of back and forth and you never mentioned you were already doing all of this ๐
i understand. i'll continue troubleshooting. i appreciate your time
I'm helping, I'm not giving up. I just need to go back to the real question. We took long detours. But it seems that you understand proration, you already have logic to preview the proration, and you now confirmed you have logic to update the Subscription yourself.
So after that exact step, what is/isn't working?
I appreciate again your help. Let me start fresh, the problem is when upgrading from a currently plan where a user has already paid $500 (normally $1000), in the future they decide they want to need more users or admins so the next plan allows them to upgrade (i'm using an api call "Create a plan") . If the user input an additional location, the popup will show the user that the cost is in this case $22.42. The plan itself will create a quote with the minimum number of users, locations & admins and provide me with a quote. Lets say that the total is $1,045 a year (this is also being displayed to the user that this will be the new price after the 1st year. Now the problem is when i take the user to the checkout its showing the user that they need to pay $522.50 but it really needs to show $22.42 because the user already paid $500 from a previous plan and because we are offering 50% discounts for 1st time users, as well as any upgrades that they want within the year.
๐
I'm sorry you gave the exact same summary again that is all super high level and confusing
You already built all of this. You already show the proration. You already change the Subscription. You shared the pictures of Bubble configuring this. You should not send the customer anywhere after that.
What I am asking you is to explain what happens after you update the Subscription which would be right after the step in your last picture. Please try to solely focus on this, not your overall plan
what happens after that is Stripe does change to user to the upgraded subscription but charged the user $522.50
Here you go. Now we are talking about something real.
Please share
- The exact response you get for the Upcoming Invoice call
- The exact response you get for the Update Subscription call
- A clear and exact example: Subscription id, what Price(s) you had, what Price(s) you're switching to, the exact resulting Invoice id and what is not calculated properly
This is crucial and this is the one bit of information we need to focus on. None of the rest is relevant/useful for now.
got it, let me create new one right now and i'll provide you with all this information
I now have to run and my colleague is taking over and will help. Please do your best to only talk about the API. I would highly recommend that you temporarily stop using Bubble entirely and learn to use our APIs with real code locally. This would make things much easier for you (and for us to help you). This is not about your real environment in production in Bubble, that's fine. It's about how confused you seem to be by the whole behaviour and Bubble gets in the way of your understanding here.
It'll likely take you some more time but it will save you days of confusion in the end