Skip to content
Snippets Groups Projects
Commit 985c0c5d authored by Joshua Walker's avatar Joshua Walker
Browse files

Merge pull request #115 from BorislavZlatanov/patch-1

Fix cancelling of an existing subscription
parents dabc9e2d 6eedaa5b
Branches
Tags
No related merge requests found
......@@ -574,7 +574,11 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
// card to be charged immediately. So, since Stripe only supports one
// subscription per customer, we have to cancel the existing active
// subscription first.
if (!empty($stripe_customer->subscription) && $stripe_customer->subscription->status == 'active') {
$subscriptions = $stripe_customer->offsetGet('subscriptions');
$data = $subscriptions->offsetGet('data');
$status = $data[0]->offsetGet('status');
if (!empty($subscriptions) && $status == 'active') {
$stripe_customer->cancelSubscription();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment