#shehzadnizamani_docs

1 messages ¡ Page 1 of 1 (latest)

timid shardBOT
#

👋 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/1316638305940537365

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

bleak jay
warm ridge
#

Thank you @bleak jay follow up question, can I get user's current trial_end value from user's existing subscription object? From what I have tried so far I am unable to get user's trial_end of has_trial values

#

Also I can find in Stripe documentation how can I set trial_end, your documentation explains that I can pass phases.trial_end here:
https://docs.stripe.com/api/subscription_schedules/create#create_subscription_schedule-phases-trial_end
But when I try to do this typescript throws an error, do you have a link to doc with code example which shows how I can pass trial_end while getting value of trial_end from user's existing subscription?

bleak jay
#

can I get user's current trial_end value from user's existing subscription object?
You can get from the trial_end on existing subscription: https://docs.stripe.com/api/subscriptions/object#subscription_object-trial_end

But when I try to do this typescript throws an error
Could you share your code on setting the trial_end on the phases?

warm ridge
#

I think I figured that out how to pass trial_end when scheduling subscription downgrade. Could you verify if this code is correct:
const subscriptionScheduleUpdated = await this.stripe.subscriptionSchedules.update( subscriptionSchedule.id, { end_behavior: 'release', proration_behavior: 'none', phases: [ { items: [ { price: subscription.items.data[0].plan.id, }, ], start_date: subscription.current_period_start, // end_date: endDate, iterations: 1, trial_end: endDate, }, { items: [ { price: newPriceId, }, ], start_date: endDate, }, ], } );

bleak jay
warm ridge
#

Thanks, I will test this out with test clock. One last question, since we are going to be using schedules to downgrade a user's subscription. Related usecase is user cancelling their subscription while downgrade is scheduled. What does Stripe recommends we do in this case. There are two possible flows we can perform:

  1. Cancel upcoming downgrade i.e release the downgrade schedule, and then perform cancellation by updating subscription and setting cancel_at_period_end: true,
  2. Second option is we update future schedule, which was supposed to downgrade user's subscription and set schedule end_behavior: 'cancel,
    I want to know what Stripe recommends we do when doing downgrades along with cancellations
bleak jay
#

Either way is fine, but option (1) may be easier to maintain since you don't have to keep track of another object type - Subcription Schedule

warm ridge
#

Yes that is my thought too, thank you for your help