#xerusky_api

1 messages ¡ Page 1 of 1 (latest)

open tartanBOT
#

👋 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.

brittle island
#

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

young pewter
#

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?

brittle island
#

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);
young pewter
#

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?

brittle island
#

that is the thing, i am not doing that still i am getting that error

young pewter
brittle island
#

mmm let me see

#

ok i will try with the tutorial and see if it works for my case. Thanks

young pewter
#

No worries. You can reach out anytime if you get stuck.

brittle island
#

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.

young pewter
#

Great to hear!