Stripe-如何处理订阅与免费计划,没有信用卡需要在注册时间

我们开始在 < strong > Redsmin 上实现 Stripe (我们的一个项目) ,我认为我们可能遗漏了一些东西。它是这样运作的:

  1. 要使用我们的产品,用户必须选择一个计划(free,s,m,xl,xxl...) ,然后输入其登录/密码,这样就可以进行为期30天的免费试用。当用户提交表单时,我们的服务器使用指定的计划调用 Stripe 原文: http://stripe.com/docs/api # create _ customer,不使用信用卡(因为我们想提供30天免费服务,不需要信用卡) ,我们用返回的 customer_idsubscription_id更新我们这边的用户模型。

  2. 我们设置了一个 webhook 接收条纹事件,所以在30天后,我们的 webhook 应该接收一个 customer.subscription.updated事件和一个 object.status == active我说的对吗?

  3. 但是,由于我们没有为用户在注册时指定一个相关的卡,我们 应该收到后,另一个 customer.subscription.updated事件与 object.status == unpaid的权利?然后在我们这边,我们关闭用户帐户并强制它转到我们的计划选择页面。

  4. 从那时起,用户可以选择免费计划或我们的溢价计划之一:

  5. # 场景1 如果用户选择空闲计划,我们只需要在我们这边重新激活它的帐户,不做任何其他事情,因为我们在 stripe 上将空闲计划配置为0 $。我们是否用我们的免费计划实施了正确的过程?有更好的办法吗?

  6. # 场景2 如果用户选择了一个溢价计划,我们将他重定向到一个信用卡表单,然后将其发送到 Stripe,并使用临时卡令牌更新 Stripe 客户帐户。返回文章页面

    • 我们要等 Stripe 给我们发个活动吗?如果有,是什么事件?customer.subscription.updatedcharge.succeeded?那么 object.status的值是多少呢?
    • 我们是否应该直接重新激活我们这边的用户帐户,并等待来自 stripe 的确认?如果是,我们应该等待的事件名称和数据是什么?

37822 次浏览

In part 2 where you do this:

We set up a webhook to receive stripe events so after 30 days our webhook should receive a customer.subscription.updated event with a object.status == active am I right?

You might also consider implementing the customer.subscription.trial_will_end webhook, this webhook will be sent three days before the customers trial is going to end and will allow you to send the customer a notification to update their payment information.

This way if the user does decide to go and update their payment information, Stripe will be able to take payment as soon as the customers trial has ended and they will be able to continue using your service without interruption.

#Scenario 1 If the user select the free plan, we just reactivate its account on our side and do nothing else because we configured the free plan on stripe to cost 0$. Did we implemented the right process with our free plan? are there better ways?

As far as I know this is the best way of implementing free plans using Stripe, I would just probably make sure that customers weren't sent any invoices unless it was required. I doubt users would expect to receive an invoice for each billing period if they were using a free plan.

#Scenario 2 If the user select a premium plan, we redirect him to a credit card form, that will be then sent to Stripe, and we update the stripe customer account with the temporary card token. What should we do next?:

  • Should we wait for stripe to send us an event, if so, what event? customer.subscription.updated? charge.succeeded? What will be the value of object.status then?
  • Should we directly reactivate the user account on our side and wait for a confirmation from stripe? If so, what would be the event name and data we should wait for?

Once the user has selected a plan and updated their payment information I would activate their account straight away providing that the response to the subscription update from Stripe was successful.

As long as you have configured your subscription preferences from your Stripe dashboard you should be able to let Stripe handle what it will do if the payment fails. Just make sure you implement the customer.subscription.updated webhook as this will be the webhook that Stripe will send you if they mark a subscription as unpaid or cancelled allowing you to update your own records accordingly.