What happens if a customer re-subscribes to a plan that has a trial period?
To be more precise:
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?
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)