#oftysterista_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/1397509458141118555
๐ 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.
- oftysterista_api, 24 minutes ago, 18 messages
- oftysterista_api, 1 day ago, 67 messages
- oftysterista_api, 1 day ago, 76 messages
- oftysterista_api, 2 days ago, 31 messages
- oftysterista_api, 5 days ago, 13 messages
๐ happy to help
Thanks
your code already does what you're expecting
another way to do that is by using subscription schedules
to make sure that the change gets applied in the next billing cycle
yes previosly your colleague is suggesting me using the schedules
but when i try my code actually it is working fine and it is more simple
so i am worry if there is anything wrong?
the difference between the 2 approaches is when the customer.subscription.updated event happens
your code will automatically change the subscription to the new price, whereas in the schedule you will have the change happen on the next billing cycle
yes i know my code is automatically happens
but my question is it will not charges the customer immediately?
yes it won't since you used proration_behavior: 'none'
Yes, I tried it and it actually works. But if the price I change has a different interval, is it safe?
yes but in that case would you want to start the billing cycle now or keep it as is?
let say i want to keep it as it is. for example
current price is 10USD/Month.
and already run half way.
then i want to change it to 100USD/year
are u still there?
yes I'm here
but do you want the year to start from now or by the end of the cycle?
the end of the cycle
in that case you would need to do that with a subscription schedule
or actually you don't
you just need to pass billing_cycle_anchor: "unchanged"
ohh i see so we dont need to use schdule. just put the billing cycle anchor to unchanged?
it will keep the current cycle?
yes correct
so if i dont pass the billing_cycle_anchor: "unchanged". the cycle will end immediately and start a new cycle with the new period.
and and there will be no refund because I set the proration to none.
am i correct?
no
the cycle won't technically end
let me give you an example so it would be easier to follow
sure
so let's say on July 1st you created a subscription for a customer with a 10$/month price. On July 17th you upgraded the subscription to a 100$/year price with proration_behavior: 'none' and billing_cycle_anchor: 'unchanged' what this will result into is the following
1- no invoice would be created on the 17th
2- a customer.subscription.updated event will be sent with the new price
3- the current period would be from the 17th till the 31st with the yearly price
4- on Aug 1st a new invoice would be generated for a yearly price that ends on July 31st next year
okay i got it.
but what if i dont pass this billing_cycle_anchor: 'unchanged'?
1- new invoice would be created on the 17th?
2- a customer.subscription.updated event will be sent with the new price
3.- what happen to current period? it is end now?
1- new invoice would be created on the 17th?
no
2- a customer.subscription.updated event will be sent with the new price
yes
3.- what happen to current period? it is end now?
the yearly plan starts on the 17th
the yearly plan start on 17th but the invoice is not generated?
how come?
We'd always generate an invoice immediately for a monthly -> yearly upgrade. I already answered this: https://docs.stripe.com/billing/subscriptions/change-price#billing-periods
However, switching a customer from a monthly subscription to a yearly subscription moves the billing date to the date of the switch.
and
Stripe immediately attempts payment for these subscription changes:
- When the billing period changes
https://docs.stripe.com/billing/subscriptions/change-price#immediate-payment
You really just need to try and use the API to do the flows you want and see how it behaves
yes i am trying the api right now
base on this. he said that no invoice will created on the 17th if i set the billing_cycle_anchor: "unchanged"
but when i test it it always generate the invoice
when i update the price, the invoice created immediately
are u still there?
Yes, can you please have some patience
This misspoke. If you're changing interval then we'll invoice ~immediately as I noted above
The only way to not charge immediately is by using a trial to persist the existing billing anchor
by using a trial?
So you mean I have to make the current period into a trial period?
What is the actual desired outcome here? The user upgrades from a monthly plan to a yearly plan but keeps billing date as 1st, instead of changing to now?
yes correct
Then yes, use a trial period in your update request to fix the anchor to 1st
i see so it is the only option by setting the current period as a trial if I wanted to keep it. otherwise I have to use the schedule?
use trial period will make the status into trialing right?
But this isn't necessary if the new price has the same period, right? I've tried it and it works. I just want to clarify.
Yes
Yes, as explained. If the interval (e.g. monthly) remains the same then the billing cycle doesn't change
It's ignored yes