#captainnoyaux_docs
1 messages ยท Page 1 of 1 (latest)
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.
- captainnoyaux_docs, 1 day ago, 30 messages
- captainnoyaux_docs, 1 day ago, 12 messages
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1260231909854941365
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
Hello, I'm trying to implement a minimum commitment period in stripe. To do so when a customer subscribe I create a subscription schedule from the subscription, I add 1 phase that last X iterations (e.g. X == 3) and another phase that lasts forever.
How do I handle gracefully that a user wants to cancel before the end of the first phase ?
ideally I'd want to update the subscription schedule to remove the second phase so that the subscription schedule ends whenever the first phase is reached. Is that correct ?
it seems that I can't update the phases once they are created, is that so ?
I tried that
String scheduleId = stripeClient.subscriptions().retrieve(toto.getId()).getSchedule();
SubscriptionSchedule scheduleToUpdate = stripeClient.subscriptionSchedules().retrieve(scheduleId);
List<SubscriptionSchedule.Phase> phases = scheduleToUpdate.getPhases();
phases.remove(1); // TODO check that getPhases.size == 2 at least
scheduleToUpdate.setPhases(phases);
but it doesn't want I have to call scheduleToUpdate.update()
How do I remove the phase of a subscription schedule ?
What exactly do you mean?
Oh, missed the above message, just a sec
Thanks !
How do I handle gracefully that a user wants to cancel before the end of the first phase ?
ideally I'd want to update the subscription schedule to remove the second phase so that the subscription schedule ends whenever the first phase is reached. Is that correct ?
That sounds correct, to remove the additional/second phase.
What is not working for you when you try this?
if I set the phases on the SubscriptionSchedule object it doesn't update the schedule
the update is done when you call .update() and .update takes some parameters that can only add phases not remove them
(or I am wrong and I missed it)
or maybe I create a a Param with the first phase and calls update on my schedule subscription
That doesn't sound right
but they are not of the same type ๐ฉ
I did that
String scheduleId = stripeClient.subscriptions().retrieve(subscription.getId()).getSchedule();
SubscriptionSchedule scheduleToUpdate = stripeClient.subscriptionSchedules().retrieve(scheduleId);
List<SubscriptionSchedule.Phase> phases = scheduleToUpdate.getPhases();
phases.remove(1); // TODO check that getPhases.size == 2 at least
scheduleToUpdate.setPhases(phases);
but it doesn't do anything
What you need to send is a new phases array that includes the current/active phase, but you can drop the second phase
I need to construct it myself then because this doesn't compile
I'll try to do that, does it sound like the correct way to handle a minimum commitment period using subscription schedules ?
You likely need to extract just the items and start/end date for the current phase:
https://docs.stripe.com/billing/subscriptions/subscription-schedules?lang=dotnet#updating
Rather than using the entire phase object from the retrieval
well in java it's sounds horrendous to do
I agree, an unfortunate side effect of the strict types
Well seems like bad types to me but yeah I get it
The object types and the request param types are necessarily different
Not all object attributes are valid params, for example
isn't there another way to do it ? sounds really error prone to do it that way :/
Hi there ๐ jumping in as my teammate needs to step away soon. No, the approach they described is the right one for adjusting the phases on Subscription Schedule. I'll be sure to capture your feedback for our teams that this is something you'd be interested in seeing made easier in the future.
yeah I don't doubt the approach on adjusting the phase. I'm wondering if it's the right approach for doing a commitment period
Can you elaborate a bit on what you mean by commitement period? If you're hoping to create Subscriptions, and then have those automatically adjust at points in the future, such as ending the Subscription, then leveraging Subscription Schedules is the right approach. Unless you want to build that future logic on your end.
I want a minimum commitment period when a user subscribe
for instance I want my subscription to last 1 year with at least a 3 month commitment
if my users want to cancel their subscription, I need them to stay active and charged until the 3 months have passed
Gotcha. Then yes, I would recommend using Subscription Schedules to schedule those cancellations at the end of a phase.
We don't have prebuilt functionality for forcing a Subscription to remain in place like that, that would be up to your code to check and enforce. You could do this without Subscription Schedules by using the cancel_at parameter on the Subscription object:
https://docs.stripe.com/api/subscriptions/update#update_subscription-cancel_at
but if you go that route you'll need to make sure the timestamp you provide there exactly aligns with the end of the Subscription's billing period, or else you'll end up with prorations for the cancelation.
Yeah I was looking at cancel_at but ended up not using it due to what you say on the prorations
Well I'll try with the subscription schedule then but that'd be awesome to have that kind of feature natively
It's odd that it isn't actually since it's quite a common use case
Thank you for your time and help