Add trial_end parameter to subscribe_customer_to_plan

This commit is contained in:
PCoder 2017-12-24 12:32:08 +01:00
parent b2d0fd45ad
commit 6fa8dbb5cb

View file

@ -210,12 +210,14 @@ class StripeUtils(object):
return return_value return return_value
@handleStripeError @handleStripeError
def subscribe_customer_to_plan(self, customer, plans): def subscribe_customer_to_plan(self, customer, plans, trial_end=None):
""" """
Subscribes the given customer to the list of given plans Subscribes the given customer to the list of given plans
:param customer: The stripe customer identifier :param customer: The stripe customer identifier
:param plans: A list of stripe plans. :param plans: A list of stripe plans.
:param trial_end: An integer representing when the Stripe subscription
is supposed to end
Ref: https://stripe.com/docs/api/python#create_subscription-items Ref: https://stripe.com/docs/api/python#create_subscription-items
e.g. e.g.
plans = [ plans = [
@ -227,8 +229,7 @@ class StripeUtils(object):
""" """
subscription_result = self.stripe.Subscription.create( subscription_result = self.stripe.Subscription.create(
customer=customer, customer=customer, items=plans, trial_end=trial_end
items=plans,
) )
return subscription_result return subscription_result