#novakinn
1 messages ยท Page 1 of 1 (latest)
Hello!
Yes so i have a subscription that is being created by a user but it can be downgraded or upgraded
and the thing is that when the client creates the subscription it bills them immediately and i set up a trial period so it bills every Wednesday of the week no matter when you created the subscription
but i am having problems whenever the client upgrades his/her subscription because since they are on a trial period they are not being charged instantly
and i want to charge them instantly
did I explain myself?
So you want to wait to perform an upgrade/downgrade until the end of the trial period (Wednesday)?
No, like if the client creates a subscription on tuesday then he will be billed inmediately but a trial period will start so he is billed on the next week on wednesday
but if that same tuesday the client decides to upgrade i want him to be charged immediately but that doesnt happen because he is on a trial
should i use the billing_cycle_anchor instead of the trial? what should i do with the prorations? or do they not affect anything?
How are you setting the trial? When you update the Sub the trial should be removed and then they would be billed immediately for the new Price
Do you have an example I can look at?
i run that function after i create the subscription
does the billing_cycle_anchor work the same way as a trial?
what would be the easiest way for me to do that? with the trial or the billing_cycle_anchor?
This is me creating the subscription
When you are updating the Sub you are still setting a trial_end
If you don't want a trial at that point you shouldn't be passing that
so this is my update function
the first two pictures happen when you create the subscription for the first time
the third picture is when i update it.
When i am updating is when i want them to be charged immediately if the upgraded their subscription
but since i set a trial before that is not happening
should i end the trial period and start it again? so they are still billed on every wednesday?
Can you give me a Sub ID that you tested with so I can look at exactly what hapepned?
Sorry, having a hard time grasping from just looking at pictures of code
Hi there. Taking over for bismarck as they have to step out. Give me a few to catch up here
Ok I think I understand what you're trying to do. Let me recap to see if I got it. So you want to charge the customer immediately when they subscribe. However, you want to bill them every single wednesday after they subscribe, so you use a trial to make sure that happens. However, if a customer upgrades their subscription in that trial period, you still want to bill them upon upgrading. Do I have that correct?
Ah ok I see. So when the customer upgrades in the trial period, do you want to charge them the full amount, or a prorated amount for the upgrade?
I want to charge them the difference
so if they paid 100 and they upgrade to one of 120
i want to charge them 20
Sorry i have trouble understanding the word "prorated"
No worries. What you described is the prorated amount
Gotcha. This might be tricky to do with just subscriptions. Have you looked into subscription schedules at all? This might be what you're after: https://stripe.com/docs/billing/subscriptions/subscription-schedules
Okay i will look into it
just one question
what is the billing_cycle_anchor?
is that another way to move the billing date?
Yeah that's exactly it. It's the day that the subscription is billed on. I'll let you read through the subscription schedule docs so you can fully understand how they work, but what I'd recommend with a subscription schedule is to start the schedule and first phase immediately when you create the sub schedule for the full price, then you would have a second phase that starts on the upcoming wednesday so that your customer will be billed on that cadence going forward. If the customer decides to upgrade their subscription, you'd just upgrade the price on the current, active phase. I think that should achieve what you need.
Alright i briefed through the documentation
So i understand what you are saying
but will the second phase keep the same price of the first phase?
It will be whatever price you tell it to bill
You can update it too in the update request
Okay so i am reading more. So it says that when one phase ends "based on the attributes of the next phase" it starts automatically. Does this mean it inherits the previous attributes or do i, admin, have to set the price it takes.
I want it to just inherit the price the last phase had, since it will be what the client upgraded or downgraded to
I just want to verify i understand before testing
No it doesn't inherit anything. You have to explicitly set everything in each phase
So if the customer upgrades prices in phase 1 and you want that to be the same price in phase 2, you'll have to change the price in phase 2 as well when you update the subscription schedule
So if I have 10 customers that upgraded or downgraded i have to go in and set every phase?
Well it would just be 1 api request per customer that updates every phase
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Recommend reading through the subscription schedule docs fully first so you understand how they work
Alright i will! thank you! if i keep having trouble can i contact you directly or is this chat saved?
No problem! We archive threads after some time of inactivity, but if you post in the main dev-help channel, then someone can open a new thread for you