Skip to content

Commit bece8d5

Browse files
authored
chore(payments): Make support for sending trial days to 0 (Fueled#3)
1 parent b5bdb6f commit bece8d5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

payments/models.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,11 @@ def subscribe(self, plan, quantity=None, trial_days=None,
553553
cu = self.stripe_customer
554554

555555
subscription_params = {}
556-
if trial_days:
556+
# https://stripe.com/docs/api?lang=python#create_subscription-trial_end Special keyword Now is for ending
557+
# the trial now
558+
if trial_days is 'now':
559+
subscription_params["trial_end"] = 'now'
560+
elif trial_days:
557561
subscription_params["trial_end"] = \
558562
datetime.datetime.utcnow() + datetime.timedelta(days=trial_days)
559563
if token:

0 commit comments

Comments
 (0)