From 370651f1696d54eb7cb4ef266db93b153cda6fe9 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 10 Oct 2024 13:51:41 +0100 Subject: [PATCH] Release any schedule before cancelling. You cannot cancel a subscription with a schedule. --- www/docs/api/cancel-plan.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/www/docs/api/cancel-plan.php b/www/docs/api/cancel-plan.php index 601dd268b0..bcfe383a01 100644 --- a/www/docs/api/cancel-plan.php +++ b/www/docs/api/cancel-plan.php @@ -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'); }