#alalva_subscription-proration

1 messages ยท Page 1 of 1 (latest)

gaunt houndBOT
#

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

alpine apex
#

I'm including a couple pictures next

hallow fable
#

alalva_subscription-proration

alpine apex
#

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

hallow fable
#

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

alpine apex
hallow fable
#

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

alpine apex
#

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

hallow fable
#

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?

alpine apex
#

2nd the user, in the sure

hallow fable
#

what?

alpine apex
#

sure

hallow fable
#

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?

alpine apex
#

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.

hallow fable
#

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

alpine apex
#

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.

hallow fable
alpine apex
#

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.

hallow fable
#

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

alpine apex
#

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

hallow fable
#

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)

alpine apex
#

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

hallow fable
#

The Portal definitely lets you do that

alpine apex
#

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.

hallow fable
#

But okay let's focus on one unoque problem otherwise this will never work.

#

So please, share the proration code specifically

alpine apex
#

i'm trying to get the thread from previous conversations on the proration formula

hallow fable
#

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

alpine apex
#

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.

hallow fable
#

Okay, please share the exact code. I'm not doing this to be annoying, I'm doing to show you how it works

alpine apex
#

i'm using Bubble which is a no code platform -

hallow fable
#

That's a picture

#

Do you have real code running on your laptop to test all of this?

alpine apex
#

i'm using bubble which is a no code platform, i don't think it can show me the code.

hallow fable
#

Sadness, this explains a lot ๐Ÿ˜…

alpine apex
#

haha

#

unfortunately

hallow fable
#

This is going to be much harder because that isn't real code

alpine apex
#

i'll read thru the documents & see if i can understand this better.

hallow fable
#

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?

alpine apex
#

yes

#

i'm doing this so i can show the user a preview of what the charge would be

hallow fable
#

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

alpine apex
hallow fable
#

I can't really debug a picture I'm sorry. Their UI is impossible to understand (for me)

alpine apex
#

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

hallow fable
#

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 ๐Ÿ˜…

alpine apex
#

i understand. i'll continue troubleshooting. i appreciate your time

hallow fable
#

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?

alpine apex
#

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.

hallow fable
#

๐Ÿ˜…

#

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

alpine apex
#

what happens after that is Stripe does change to user to the upgraded subscription but charged the user $522.50

gaunt houndBOT
hallow fable
#

Here you go. Now we are talking about something real.

#

Please share

  1. The exact response you get for the Upcoming Invoice call
  2. The exact response you get for the Update Subscription call
  3. 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.

alpine apex
#

got it, let me create new one right now and i'll provide you with all this information

hallow fable
#

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