条纹订阅 - 即使第一次计费尝试失败也创建

Stripe Subscriptions - Create even if first billing attempt fails

在 Stripe 的 API 文档中,尝试为客户创建订阅时返回的值描述如下:

The newly created subscription object if the call succeeded. If the customer has no card or the attempted charge fails, this call returns an error (unless the specified plan is free or has a trial period).

据此,我假设如果第一次尝试收费失败(并返回错误),这意味着订阅尚未创建?

我希望能够为尚未添加任何计费来源的客户创建订阅,一旦他们添加了计费来源,就会处理第一笔付款。有办法实现吗?

From this, I am assuming that if the first attempted charge fails (and an error is returned) this means that the subscription has not been created?

是的,没错。

I am wanting to be able to create subscriptions on customers who may not yet have any billing sources added and as soon as they add a billing source the first payment will be processed. Is there a way to accomplish this?

您可以使用 0 美元的套餐创建订阅,或者使用 trial_end 创建带有试用版的订阅以创建 'free' 订阅。

至于 "as soon as they add a billing source the first payment will be processed." -- 您需要创建逻辑来自行处理。当用户添加支付来源时,您可以更新他们的订阅以结束试用 (trial_end=now),或将他们转移到付费计划。

https://stripe.com/docs/api#update_subscription