4

What happens if a customer re-subscribes to a plan that has a trial period?

To be more precise:

  1. A customer subscribes to a plan with a 30 day trial period.
  2. When this trial period ends, the customer decides to cancel the subscription.
  3. The customer later re-subscribes to the plan.

Will they have access to the trial days again?

How am I able to determine if the user has already consumed the trial period so I can process their re-subscription without a trial period?

Godfrey Duke
  • 1,505
  • 16
  • 19
Ben
  • 3,972
  • 8
  • 43
  • 82

1 Answers1

4

My solution:

I check if the customer has a cancelled subscription for this plan. If it's the case, I create a subscription with trial_end to 'now':

if len(stripe.Subscription.list(status='canceled', customer=stripe_customer_id, plan=plan_id)['data']) > 0:
    stripe.Subscription.create(
        customer=stripe_customer_id,
        plan=plan_id,
        trial_end='now')     
else:                
    stripe.Subscription.create(
        customer=stripe_customer_id,
        plan=plan_id)  
Ben
  • 3,972
  • 8
  • 43
  • 82