Skip to content

Commit

Permalink
Add trial_from_plan, trial_period_days args to Customer.subscribe()
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhill authored and jleclanche committed Jul 22, 2018
1 parent 4db1545 commit a38cf04
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion djstripe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,8 @@ def pending_charges(self):

def subscribe(
self, plan, charge_immediately=True, application_fee_percent=None, coupon=None,
quantity=None, metadata=None, tax_percent=None, trial_end=None
quantity=None, metadata=None, tax_percent=None, trial_end=None, trial_from_plan=None,
trial_period_days=None
):
"""
Subscribes this customer to a plan.
Expand Down Expand Up @@ -922,6 +923,14 @@ def subscribe(
:param charge_immediately: Whether or not to charge for the subscription upon creation. If False, an
invoice will be created at the end of this period.
:type charge_immediately: boolean
:param trial_from_plan: Indicates if a plan’s trial_period_days should be applied to the subscription.
Setting trial_end per subscription is preferred, and this defaults to false.
Setting this flag to true together with trial_end is not allowed.
:type trial_from_plan: boolean
:param trial_period_days: Integer representing the number of trial period days before the customer is
charged for the first time. This will always overwrite any trials that might
apply via a subscribed plan.
:type trial_period_days: integer
.. Notes:
.. ``charge_immediately`` is only available on ``Customer.subscribe()``
Expand All @@ -942,6 +951,8 @@ def subscribe(
metadata=metadata,
tax_percent=tax_percent,
trial_end=trial_end,
trial_from_plan=trial_from_plan,
trial_period_days=trial_period_days,
)

if charge_immediately:
Expand Down

0 comments on commit a38cf04

Please sign in to comment.