#subhrajeet_api

1 messages ยท Page 1 of 1 (latest)

outer flowerBOT
#

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

gleaming sunBOT
#

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.

digital elbow
barren summit
#

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?

digital elbow
#

You can try it out and see if it works as per how you expect

barren summit
#

But one thing

#

Won't it results in adding the new price so both prices are active for the subscription

outer flowerBOT
digital elbow
#

When you update the Subscription, you specify the subscription item to apply the updated price to.

barren summit
#

Ok let me try this

merry dirge
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

barren summit
#

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?

merry dirge
#

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

barren summit
#

So what's the solution if I have already created inline products?

#

How to change the billing interval in that case?

merry dirge
#

you need to create a new product and a new price

#

and then update the subscription

barren summit
#

Let me try this and get back to you

merry dirge
#

sure

barren summit
#

And one more thing

#

I want that the billing interval change should be effective from the period_end of current billing, is this possible?

merry dirge
#

in that case it's better to use Subscription Schedules

barren summit
#

So this is possible in Subscription Schedules-
"you need to create a new product and a new price and then update the subscription"?

merry dirge
#

"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

barren summit
#

Let me try

#

Can you please help me with flow breifly?

merry dirge
#

first create a product

#

then create a price with the product id from the product you just created

barren summit
#

Thanks for the help, let me try this

barren summit
#

Created a subscription schedule, but unable to change the start and end time
This is the request id-req_56XtDQjSTkH30g

merry dirge
#

once you do this step

#

you need to then use the subscription schedule ID it generated

#

with the last step I shared

gleaming sunBOT
barren summit
#

{
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?

merry dirge
#

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?

barren summit
#

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

solemn warren
#

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?

barren summit
#

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

solemn warren
#

what do you mean by "take the interval"?

#

the subscription would move to the new Price when your schedule tells it to(at the end of the current phase) and at that point it will start billing yearly, sure

barren summit
#

ok got it, I thought it would immediately start reflecting in subscription schedule object

#

You are absolutely correct, but is there any way to fast forward the current subscription?