#Min.K
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
Q1. No period != phase. A Phase could contains multiple periods
Q2. It shouldn't IMO. Please provide some Id in case you want to clarify on a concrete example
Q3. Using trial_end will mark the period free (no charge). If you want to downgrade to a less expensive price, but still not 0 then you need Subscription Schedule
But Subscipriton Schedule is a bit complex. I suggest playing with it in Test mode, using Test Clock to fully test and understand its behavior
Thank you so much!
Q4. So if I want to downgrade the subscription after the end of the current cycle, can I call it like below?
// Get Subscription
$subscription = \Stripe\Subscription::retrive([
'id' => $subscriptionId,
]);
// Create Subscription Schedule with from_subscription
$sched = \Stripe\SubscriptionSchedule::create([
'from_subscription' => $subscription->id,
]);
// Update Subscription Schedule using subscription's current_period_start & current_period_end
\Stripe\SubscriptionSchedule::update($sched->id, [
'phases' => [
[
"start_date" => $subscription->current_period_start,
"end_date" => $subscription->current_period_end,
'items' => [
[
'price' => $gold->id,
'quantity' => 1,
],
]
],
[
"start_date" => $subscription->current_period_end,
'items' => [
[
'price' => $silver->id,
'quantity' => 1,
],
],
],
]
]);
Q5. To fulfill the requirements in Q4, I think I need to do it in the following order, is that correct?
- Get current_period_start and current_period_end from Subscription.
- create a Create Subscription Schedule API via fom_subscription.
- update the start_date and end_date of the current phase with the current_period_start and current_period_end values from step 1 through Update Subscription Schedule.
This is too complicated. Is there any way to get current_period_start and current_period_end without a subscription lookup? I know that when I do Create Subscription Schedule, the information from the subscription is copied. Is there any way to get the current_period_start and current_period_end information in the Subscription Schedule?
Q6. What if I look up a subscription and get both current_period_start and current_period_end, but by the time I update the subscription schedule, a new period has already started for the current subscription? Will it throw an error?
@carmine garden
May I ask you to respond to the above?