简体   繁体   English

如何在结帐期间在条带上传递现有订阅详细信息

[英]How to pass existing subscription details on stripe during checkout

I've different subscription plan on stripe starting from Zero.从零开始,我有不同的条带订阅计划。 When customer sign up, I'm creating a subscription with free plan by default.当客户注册时,我默认创建一个带有免费计划的订阅。

In the future, customer want to upgrade the plan through checkout session, how can I pass my existing subscription details to the checkout session to update the plan tagged to the subscription ID instead of creating multiple subscriptions.将来,客户希望通过结帐 session 升级计划,如何将我现有的订阅详细信息传递给结帐 session 以更新标记为订阅 ID 的计划,而不是创建多个订阅。

I gone through the stripe create checkout session Doc but I couldn't find a way to pass subscription ID in checkout session.我浏览了条带创建结帐 session 文档,但我找不到在结帐 session 中传递订阅 ID 的方法。

Any help would be much appreciated任何帮助将非常感激

You are trying to update an existing Subscription through a CheckoutSession, that is not supported.您正在尝试通过CheckoutSession 更新现有订阅,这是不受支持的。

If a customer uses Checkout to sign up for a new Price, that creates a completely new Subscription object.如果客户使用 Checkout 注册新价格,则会创建一个全新的订阅 object。 You cannot pass an existing Subscription ID as Checkout cannot modify that.您无法传递现有的订阅 ID,因为 Checkout 无法修改它。

You should use Checkout in mode: setup to collect card details from your customer.您应该在mode: setup从您的客户那里收集卡详细信息。 This setup mode only collects card details but does not charge or create a Subscription on that Customer.setup模式仅收集卡详细信息,但不会对该客户收费或创建订阅。

Then in your server-side code after you receive the checkout.session.completed webhook event, update the existing Subscription to switch from the "free" Price to the "paid" Price: https://stripe.com/docs/api/subscriptions/update然后在您的服务器端代码中收到checkout.session.completed webhook 事件后,更新现有订阅以从“免费”价格切换到“付费”价格: https://stripe.com/docs/api/订阅/更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在结帐过程中以条带形式发送元数据? - How to send metadata in stripe during checkout process? Stripe:通过 Stripe Checkout 在现有订阅产品上设置 billing_cycle_anchor - Stripe: Set billing_cycle_anchor on existing subscription product via Stripe Checkout 您如何在 Stripe 结账时将客户链接到订阅? - How do you link customer to subscription on Stripe checkout? 如何在 django 项目中结帐 session 后检索条带订阅 ID? - How to retrieve a stripe subscription id after a checkout session in a django project? 将客户电子邮件传递给条带结帐 - Pass customer email to stripe checkout 如何将变量描述传递给Stripe Checkout Express后端 - How to pass a variable description to Stripe Checkout Express backend Stripe Checkout-如何将值传递给Webhook? - Stripe Checkout- How to pass a value through to webhook? 如何将信息传递给 stripe.checkout.sessions.create() 函数 - How to pass information to the stripe.checkout.sessions.create() function 如何将订单详细信息传递给 PayPal 智能按钮结账 - How can I pass order details to a PayPal smart button checkout Stripe Checkout 订阅付款失败重定向到过期链接页面 - Stripe Checkout Subscription Payment failure redirects to Expire Link Page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM