#jayamini_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/1324733852836696148
๐ 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.
- jayamini_code, 1 day ago, 16 messages
๐ happy to help
hi thanks!
This setup works when we migrate plans the same day subscription is created but when we used test clock to pass few days (to Jan 6) of the active monthly subscription and schedule subscriptionSchedules like in the given code users are created an invoice for the used dates and 30days subscription is started from Jan 6 onwards but plan start date is Jan 3rd. how should we handle this for our requirement?
you need to pass the subscription item id
just let me understand something here, are you creating the subscription schedule on Jan 3rd or on Jan 6th? and when does the subscription start?
we have created the subscription today Jan 3rd. we have used test clock to advance time to Jan 6th. after that we created the subscription schedule using from_subscription with a stripe api call
then updated phases to set new 30 days plan with start_date as subscription.start_date which is Jan 3
I'm not sure it would work this way
would you mind sharing the request ID for that request please? in the meantime I'm testing which best approach you should take for this
Sure, thanks!
subscription with no prorations:
https://dashboard.stripe.com/test/logs/req_GQiHDkPnxZJ4do
request id : req_GQiHDkPnxZJ4do
Schedule Id: sub_sched_1QdAJlKk6Qk5jHuWZEjnRmyx
subscription with prorations:
https://dashboard.stripe.com/test/logs/req_UcyJJf3rkzvrdy
request id : req_UcyJJf3rkzvrdy
Schedule Id: sub_sched_1Qd9z0Kk6Qk5jHuWHggGQuQU
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
so that I would be a 100% sure I'm testing the right thing here, you want the next phase to start in x days (30 or 365) from the first phase start right?
yeah
ok so basically the only way to do that is something a bit convoluted
issue we had is an external coupon service we use expires in 30days and 365 days intervals but our stripe subscriptions are set monthly and yearly so basically we wan to migrate them to 30 days and 365 days plans without causing any changes to user subscriptions to make them sync since we have already issued coupons for current subs
so any help to handle it would be great
sorry it's has been a bit busy
just give me a few minutes and I will be back shortly
no worries!
Ok so basically what I tried to do here is the following: update the sub sch with 3 phases, 1st phase ends now, second phase has a number of days equal to 30 - today + start_date
{
end_behavior: "release",
phases: [{
start_date: subSch.phases[0].start_date,
items: [{
price: subSch.phases[0].items[0].price,
quantity: 1
}],
proration_behavior: "create_prorations",
end_date: Date.now()/1000
}, {
start_date: Date.now()/1000,
items: [{
price_data: {
currency: "xxx",
product: "prod_xxx",
recurring: {
interval: "day",
interval_count: 30 - today + start_date
},
unit_amount: Math.ceil(x/30*(30 - today + start_date ))
}
}],
iterations:1
},{
items: [{
price_data: {
currency: "x",
product: "prod_xxx",
recurring: {
interval: "day",
interval_count: 30
},
unit_amount: x
}
}],
}]
}
does that make sense?
you might need to tweak a bit the code for your usage but it's the best I was able to come up with, with the constraints you have
yeah this makes sense ,
would setting end_behavior to cancel work for the subsciptions that are currently set to cancel at end of old monthly plan?
yes
gotcha
also we would still have to create schedule with from_subscription and then set the phases with update right? since we can't set them when using from_subscription
yes that's correct
gotcha!