如何在试用期内处理重新订阅条纹计划



如果客户重新提交具有试用期的计划会发生什么?

更精确:

  1. 客户订阅了30天试用期的计划。
  2. 当此试用期结束时,客户决定取消订阅。
  3. 客户后来将其重新提交为计划。

他们可以再次访问试用日吗?

我如何确定用户是否已经消耗了试用期,以便我可以在没有试用期的情况下处理他们的重新订阅?

我的解决方案:

我检查客户是否对该计划有取消的订阅。如果是这种情况,我创建了一个用trial_end'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)  

最新更新