From 6fa8dbb5cb4a20f487f45cbf24f668c6149da7b5 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 12:32:08 +0100 Subject: [PATCH] Add trial_end parameter to subscribe_customer_to_plan --- utils/stripe_utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/stripe_utils.py b/utils/stripe_utils.py index 58840be0..79bca243 100644 --- a/utils/stripe_utils.py +++ b/utils/stripe_utils.py @@ -210,12 +210,14 @@ class StripeUtils(object): return return_value @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 :param customer: The stripe customer identifier :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 e.g. plans = [ @@ -227,8 +229,7 @@ class StripeUtils(object): """ subscription_result = self.stripe.Subscription.create( - customer=customer, - items=plans, + customer=customer, items=plans, trial_end=trial_end ) return subscription_result