Add Stripe unsubscribe_customer method

This commit is contained in:
M.Ravi 2017-10-03 13:06:26 +02:00
parent 65745b5098
commit f044b83b8f

View file

@ -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(