(self, form_data)
Base Subscription Modification Method
Base Subscription Modification Method
Base Subscription Modification Method
def modify_subscription(self, form_data):
        ''' Base Subscription Modification Method '''
        stripe.api_key = self.config['STRIPE_PRIVATE_KEY']
        customer = stripe.Customer.retrieve(self.user.stripeid)
        all_subscriptions = stripe.Customer.retrieve(self.user.stripeid).subscriptions.all(limit=1)
        stripe_subscription = customer.subscriptions.retrieve(all_subscriptions['data'][0]['id'])
        stripe_subscription.quantity = form_data['quantity']
        if stripe_subscription.save():
            return True
        else:
            return False
def modify_subscription ( self , form_data ) : stripe . api_key = self . config [ 'STRIPE_PRIVATE_KEY' ] customer = stripe . Customer . retrieve ( self . user . stripeid ) all_subscriptions = stripe . Customer . retrieve ( self . user . stripeid ) . subscriptions . all ( limit = 1 ) stripe_subscription = customer . subscriptions . retrieve ( all_subscriptions [ 'data' ] [ 0 ] [ 'id' ] ) stripe_subscription . quantity = form_data [ 'quantity' ] if stripe_subscription . save ( ) : return True else : return False