Skip to content
Snippets Groups Projects
Commit ce9bc385 authored by BorislavZlatanov's avatar BorislavZlatanov
Browse files

Check if there are no existing subscriptions before attempting cancelling

parent f9b41896
No related branches found
No related tags found
No related merge requests found
......@@ -576,10 +576,13 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
// subscription first.
$subscriptions = $stripe_customer->offsetGet('subscriptions');
$data = $subscriptions->offsetGet('data');
$status = $data[0]->offsetGet('status');
if (!empty($subscriptions) && $status == 'active') {
$stripe_customer->cancelSubscription();
if(!empty($data)) {
$status = $data[0]->offsetGet('status');
if ($status == 'active') {
$stripe_customer->cancelSubscription();
}
}
// Attach the Subscription to the Stripe Customer.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment