#kitem-Subscription

1 messages ยท Page 1 of 1 (latest)

haughty orbit
#

Hi there, can you share with me the subscription schedule ID?

nimble tree
#

Hey, sure, this sub_sched_1LAUUaE9n8wrXE2iHxzlaNZv

#

(is in test mode)

#

actually I want to schedule the update on sub_1LAURhE9n8wrXE2iBwK4YWeo

#

\Stripe\SubscriptionSchedule::create([
'customer' => $customer_stripe,
'end_behavior' => 'release',
'start_date' => $current_period_end,
'phases' => [
[
'items' => [
[
'price' => $price_id,
'quantity' => 1,
],
],
'iterations' => 1,
],
],
]);

#

this is the code used

haughty orbit
nimble tree
#

ok, so specify the phases is mandatory, because I've tried to do that with from_subscription

#

in this way

    $subscriptionUpdate = \Stripe\SubscriptionSchedule::create([
                    'end_behavior' => 'release',
                    'from_subscription' => $subscription_id,
                    'phases' => [
                        [
                            'items' => [
                                [
                                    'price' => $price_id,
                                    'quantity' => 1,
                                ],
                            ],
                            'iterations' => 1,
                        ],
                    ],
                ]);
#

this seems update directly the subscription, without waiting for the end of the current cycle

#

so I need to add there the "current phase" with the current price_id and the next phase with the new downgraded price_id?

haughty orbit
#

You don't need to pass the phases when creating a subscription schedule with from_subscription param

nimble tree
#

ok but i don't want to update the subscription now, I want to schedule the update to the end of the current billing cycle

#

so you mean, something like this?

$subscriptionUpdate = \Stripe\SubscriptionSchedule::create([
                    'end_behavior' => 'release',
                    'from_subscription' => $subscription_id,
        
                            'items' => [
                                [
                                    'price' => $price_id,
                                    'quantity' => 1,
                                ],
                            ],
                            'iterations' => 1,
            
                ]);
haughty orbit
#

You need to make two API calls

  1. Create the subscription schedule with from_subscription param
  2. Update the subscription schedule with the downgrading phase.
nimble tree
#

Ok, so is mandatory to

  1. create subscription schedule (only with from_subscription param?)
  2. update subscription schedule with the downgrade plan
#

to achieve this result, I'll try now

haughty orbit
#

Yes exactly like this ๐Ÿ™‚