#_greggles_
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.
- greggles-subscription-bca, 21 minutes ago, 10 messages
Can you elaborate? Which part is confusing?
$restart_date = '1704096000'; // Jan 1, 2024
// Create a subscription schedule with the existing subscription
$schedule = $stripe->subscriptionSchedules->create([
'from_subscription' => 'sub_ERf72J8Sc7qx7D',
]);
// Update the schedule with the new phase
$stripe->subscriptionSchedules->update(
$schedule->id,
[
'phases' => [
[
'start_date' => 'now',
'end_date' => $restart_date,
],
[
'billing_cycle_anchor' => 'phase_start',
'end_behavior' => 'release'
],
],
]
);
Ugh, formatting
Specifically, what should be in the first phase? Just a start and end date? For instance I want to start charging a paused subscription on January first.
phase[0] would be what you want to charge immediately upon update in this case. phase[1] would be the next phase for the future state of the subscription
phase[0], charge nothing and continue to be paused, phase[1] charge the normal subscription rate
Hello?
The server is busy, so we're a bit slower to respond than usual. To answer your question: yes.
The documentation isn't specific about this scenario so I'm asking: from the code block above, what else do I need to specify in each phase in order to take a paused subscription and transition the billing anchor to January 1st?
The only two things I need to change about each existing paused subscription is setting 'pause_collection' => '', and the billing date.
Okay, so you paused the Subscription and you want to use Subscription Schedules to unpause it in the future. Am I understanding that correctly?
That's correct.
I would think the above code would work. Is the behavior different from what you intend when you run it?
I haven't run it yet. The documentation wasn't clear for this scenario. I suppose I'd need to specify the pause_collection behavior in phase[1] as well.
Gotcha, yeah you would want to have pause_collection: "" in phase[1] in this case
You can use Test Clocks to advance the time on the subscription and see if it has the intended behavior as well (not sure if you're doing that already): https://stripe.com/docs/billing/testing/test-clocks
Thank you very much for the info and your time.
Sure thing!