diff --git a/utils/stripe_utils.py b/utils/stripe_utils.py index 8fcf0ab1..58840be0 100644 --- a/utils/stripe_utils.py +++ b/utils/stripe_utils.py @@ -232,6 +232,17 @@ class StripeUtils(object): ) return subscription_result + @handleStripeError + def unsubscribe_customer(self, subscription_id): + """ + Cancels a given subscription + + :param subscription_id: The Stripe subscription id string + :return: + """ + sub = stripe.Subscription.retrieve(subscription_id) + return sub.delete() + @handleStripeError def make_payment(self, customer, amount, token): charge = self.stripe.Charge.create(