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

时间:2016-11-24 20:00:40

标签: stripe-payments subscription trial

如果客户重新订阅具有试用期的计划会怎样?

更确切地说:

  1. 客户订阅了30天试用期的计划。
  2. 当试用期结束时,客户决定取消 订阅。
  3. 客户稍后重新订阅该计划。
  4. 他们是否可以再次进入试用期?

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

1 个答案:

答案 0 :(得分: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)  
相关问题