Skip to content

Commit

Permalink
Allow for source in update subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul424 committed Apr 21, 2017
1 parent bae60ab commit c8acb98
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pinax/stripe/actions/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,18 @@ def sync_subscription_from_stripe_data(customer, subscription):
return sub


def update(subscription, plan=None, quantity=None, prorate=True, coupon=None, charge_immediately=False):
def update(subscription, plan=None, quantity=None, token=None, prorate=True, coupon=None, charge_immediately=False):
"""
Updates a subscription
Args:
subscription: the subscription to update
plan: optionally, the plan to change the subscription to
quantity: optionally, the quantiy of the subscription to change
token: if provided, a token from Stripe.js that will be used as the
payment source for the subscription and set as the default
source for the customer, otherwise the current default source
will be used
prorate: optionally, if the subscription should be prorated or not
coupon: optionally, a coupon to apply to the subscription
charge_immediately: optionally, whether or not to charge immediately
Expand All @@ -188,6 +192,8 @@ def update(subscription, plan=None, quantity=None, prorate=True, coupon=None, ch
stripe_subscription.plan = plan
if quantity:
stripe_subscription.quantity = quantity
if token:
stripe_subscription.token = token
if not prorate:
stripe_subscription.prorate = False
if coupon:
Expand Down

0 comments on commit c8acb98

Please sign in to comment.