Skip to content

Commit

Permalink
Release any schedule before cancelling.
Browse files Browse the repository at this point in the history
You cannot cancel a subscription with a schedule.
  • Loading branch information
dracos committed Oct 10, 2024
1 parent dfbce19 commit 370651f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions www/docs/api/cancel-plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
exit;
}

if ($subscription->stripe->schedule) {
\Stripe\SubscriptionSchedule::release($subscription->stripe->schedule);
}
\Stripe\Subscription::update($subscription->stripe->id, ['cancel_at_period_end' => true]);
redirect('/api/key?cancelled=1');
}
Expand Down

0 comments on commit 370651f

Please sign in to comment.