我什么时候应该考虑在 Stripe 中订阅 "active"?

When am I supposed to consider a subscription "active" in Stripe?

我什么时候应该考虑订阅 "active"?当我成功进行初始 stripe.customers.create 调用时?还是我必须等待一段时间后的 invoice.payment_succeeded 事件?

如果就在 stripe.customers.create 之后,是否意味着我可以立即致电 stripe.invoices.list,获取初始发票并保证付款?因为我想我想保存 lines.data[0].period.end 所以我的数据库在订阅期结束时与 Stripe 的数据库完全同步。

如果 stripe.customers.create 之后不合适,那么我是否应该等到 invoice.payment_succeeded 以后某个时间再让我的用户访问高级内容?这似乎很尴尬。然后我需要一个特殊案例来忽略初始付款中的 invoice.payment_succeeded 吗?还是第一次付款不触发?

我想我对这一切很困惑...

当您调用 Create Subscription API for a plan without a trial you get a subscription 对象时,这意味着您的订阅现在被认为是活动的,如果您检查 status 属性,它将被设置为 active 然后,您可以使用 current_period_end 来了解应该何时创建下一张发票。 此属性的文档说:

End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.

如果您有试用期,那么您需要等待事件 customer.subscription.updated,其中 status 变为 active