#subhrajeet_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/1219914380456759298
๐ 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.
- subhrajeet_webhooks, 1 day ago, 14 messages
- subhrajeet_webhooks, 6 days ago, 5 messages
hello! You'll want to create a new yearly Price object, then you can change the Price being using in the Subscription. You can take a look at this guide : https://docs.stripe.com/billing/subscriptions/upgrade-downgrade
hello Alex, so I dont have to cancel the existing subscription and start a new one with yearly plan, I only have to update the subscription by creating a new yearly price?
Am I on the track?
You can try it out and see if it works as per how you expect
But one thing
Won't it results in adding the new price so both prices are active for the subscription
When you update the Subscription, you specify the subscription item to apply the updated price to.
Ok let me try this
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Let me clarify it again, initially the broker subscribes to a plan through checkout session, for which I created a price inline, but now when I try to update the subscription, it says-
The product prod_Pfq5bsmtjeVkox is marked as inactive, and thus no new subscriptions can be create to any plans of this product. You provided the plan price_1OwLFvDUy9jKM7XyHnwLujHp.
So does this error persists because I had created the price inline?
when you want to update the price for a subscription you need to create a new price that links to a product that is still active
inline products won't work in this case
So what's the solution if I have already created inline products?
How to change the billing interval in that case?
Let me try this and get back to you
sure
And one more thing
I want that the billing interval change should be effective from the period_end of current billing, is this possible?
in that case it's better to use Subscription Schedules
So this is possible in Subscription Schedules-
"you need to create a new product and a new price and then update the subscription"?
"you need to create a new product and a new price and then update the subscription"?
you need to do this regardless of how you update the subscription
the subscription schedule helps you update the price at the end of the billing cycle
first create a product
then create a price with the product id from the product you just created
once you do that you would create a subscription schedule from the existing subscription https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#existing-subscription
and then you follow this guide https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#changing-subscriptions for the final step of your flow
Thanks for the help, let me try this
Created a subscription schedule, but unable to change the start and end time
This is the request id-req_56XtDQjSTkH30g
once you do this step
you need to then use the subscription schedule ID it generated
with the last step I shared
{
items: [
{
price:price.id,
quantity: 1,
},
],
iterations: 1,
},
So I need to pass only one object in items array?
The id of the price which I just created?
no you need to pass two phases
the same way it's described in the docs I sent you
did you take a look at that doc?
Did the same but not able to change the subscription billing interval, may be I am missing something
const subscriptionSchedule = await stripeInstance.subscriptionSchedules.update(
schedule.id,
{
phases: [
{
items: [
{
price: schedule.phases[0].items[0].price,
quantity: schedule.phases[0].items[0].quantity,
},
],
start_date: schedule.phases[0].start_date,
end_date: schedule.phases[0].end_date,
},
{
items: [
{
price: price.id,
quantity: 1,
},
],
iterations: 1,
},
],
}
);
Here is the relevant part of the code
what that does is change the subscription to whatever price.id is, at the end of the current cycle. Is that not what you wanted? If so, what did you want?
Yup, but shouldn't it take the interval of the price I just created after the subscription schedule is updated i.e. interval:"year"?
This is the request id of the price creation-req_dl1evyhei5Dh7x