#xerusky_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/1437933198255329291
đ 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.
- xerusky_api, 2 hours ago, 8 messages
i also tried to create an initial phase when creating the scheduler but i got You cannot set phases if from_subscription is set.; request-id: req_fDx8zqIbCcvrJS
Hi there,
sorry for the delay. It's been quite busy. Let me take a quick look
When you say you are seeing the "You can not modify the start date of the current phase." where exactly do you see that?
Yes, that is expected behavior. We are calling that out in our API docs: https://docs.stripe.com/api/subscription_schedules/create#create_subscription_schedule-from_subscription
Hey no problem
ok but help me understand how to configure this. I need to add a phase that cancels items in the next subscription period so i :
Get the subscription : sub_1SSPvi2e959zAvZlQ7Z5JxAZ
See that has no scheduler
create a scheduler with setFromSubscription option
then get the scheduler
notice that has a phase, i suppose it is the current phase
i create the next phase with items that i want on it
and when i make an update stripeClient.subscriptionSchedules().update(scheduleId, updateParams, requestOptions);
i got an error You can not modify the start date of the current phase.
and i am not doing anything to the current phase, i can share to you the code
SubscriptionSchedule schedule = stripeClient.subscriptionSchedules().retrieve(scheduleId, requestOptions);
List<SubscriptionSchedule.Phase> existingPhases = schedule.getPhases();log.info("Schedule {} has {} existing phases", scheduleId, existingPhases.size());SubscriptionScheduleUpdateParams.Builder updateParamsBuilder = SubscriptionScheduleUpdateParams.builder();
if (existingPhases.size() == 1) {
// Single phase (current) - add a new phase for period end with items to keep
log.info("Single phase detected, creating new phase starting at period end");SubscriptionScheduleUpdateParams.Phase nextPhase = SubscriptionScheduleUpdateParams.Phase.builder() .setStartDate(currentPeriodEnd) .setProrationBehavior(SubscriptionScheduleUpdateParams.Phase.ProrationBehavior.NONE) .addAllItem(itemsToKeep) .build(); updateParamsBuilder.addPhase(nextPhase); } SubscriptionSchedule updatedSchedule = stripeClient.subscriptionSchedules().update(scheduleId, updateParams, requestOptions);
I am a bit confused, if you want to remove an item for the future phase, why would you need to change the start_date of the current phase?
that is the thing, i am not doing that still i am getting that error
Ok, I see you are using Java. I am not super familiar with Java but I found this code snippet in our docs https://docs.stripe.com/billing/subscriptions/subscription-schedules?lang=java#:~:text=To add additional phases to a subscription schedule%2C which looks a bit different than the snippet you shared
mmm let me see
ok i will try with the tutorial and see if it works for my case. Thanks
No worries. You can reach out anytime if you get stuck.
it worked, the thing was that i was not adding the old phase to the addPhase method, it need to be there and no changes has to be made to it.
Great to hear!