#_greggles_

1 messages · Page 1 of 1 (latest)

wicked ibexBOT
#

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.

crude crag
#

Hello! What have you tried so far?

mighty oar
#

I've tried passing cancel_at_period_end in phase[1] like so

[
  'items' => [
    [
      'price' => $schedule->phases[0]->items[0]->price,
      'quantity' => $schedule->phases[0]->items[0]->quantity,
    ],
    ],
    'cancel_at_period_end': true,
    'proration_behavior' => 'none'
],
#

I do not get an error message from Stripe but nothing updates.

#

Not sure if there's a way to void phase[1] and re-set it.

crude crag
#

Just to make sure I understand it riht - you just want to make sure the subscription cancels when phase 0 is over, correct?

mighty oar
#

Yes

crude crag
#

Gotcha! So then I'd recommend updating the Subscription Schedule, only passing in phase[0] to phases and then set end_behavior: cancel

#

If you only pass in phases[0] to phases that'll effectively remove all the other phases from your schedule

mighty oar
#

Oh I see. Can you keep this thread open while I run a test, please? Should only be a few minutes.

crude crag
#

yup!

mighty oar
#

I'm sorry for the formatting. I've tried passing that value 3 different ways but the schedule does not update.

#
$update = $stripe->subscriptionSchedules->update(
    $schedule->id,
    [
        'phases' => [
            [
                'items' => [
                    [
                        'price' => $schedule->phases[0]->items[0]->price,
                        'quantity' => $schedule->phases[0]->items[0]->quantity,
                    ],
                ],
                'start_date' => $schedule->phases[0]->start_date,
                'end_date' => $jan_1_2024,
                'proration_behavior' => 'none',
                'end_behavior' => 'cancel',
            ],
        ],
    ]
);
#

Oh, formatting isn't terrible

#

I tried passing it just above 'phases'

crude crag
#

end_behavior should be top-level, not nested in phases

mighty oar
#

The subscription schedule remains unaffected. Phase 1 is still present.

$update = $stripe->subscriptionSchedules->update(
    $schedule->id,
    [
        'end_behavior' => 'cancel',
        'phases' => [
            [
                'items' => [
                    [
                        'price' => $schedule->phases[0]->items[0]->price,
                        'quantity' => $schedule->phases[0]->items[0]->quantity,
                    ],
                ],
                'start_date' => $schedule->phases[0]->start_date,
                'end_date' => $jan_1_2024,
                'proration_behavior' => 'none',
            ],
        ],
    ]
);
#

And end_behavior is still set to 'release'

crude crag
#

Can you share an example subscription schedule ID with me so I can take a look?

mighty oar
#

Sure.
sub_sched_1ODWSLGxG8m2870UyTzfqfvM

#

I'm so sorry. I had a print and exit right above that block. It does update the schedule successfully. Thank you so much for your help 🙂

crude crag
#

Aha! That would do it

#

Glad you were able to figure it out