ReactJS + Stripe:试用期天数未按预期工作
P粉773659687
P粉773659687 2024-04-01 14:55:33
[React讨论组]

Trial_period_days: 7 在我的节点函数中似乎无法被识别。知道为什么会出现这种情况吗?我缺少一个变量吗?发布到此时会导致集成错误...

const subscription = await stripe.subscriptions.create({
                customer: customer.id,
                items: [{ price: "price_1KZ3nTGxUje7SlyIDUfIXkr3" }],
                payment_settings: {
                  payment_method_options: {
                    card: {
                      request_three_d_secure: "any",
                    },
                  },
                  payment_method_types: ["card"],
                  save_default_payment_method: "on_subscription",
                },
                trial_period_days: 7,
                expand: ["latest_invoice.payment_intent"],
              });

P粉773659687
P粉773659687

全部回复(1)
P粉492959599

当您创建包含试用版或 100% 优惠券的订阅时,无需立即支付发票。因此,没有 PaymentIntent,也没有 client_secret。这就是您的 PaymentIntent 确认失败的原因。相反,订阅会创建一个SetupIntent来收集将来使用的付款方式。您可以通过 pending_setup_intent.client_secret 属性 访问SetupIntent的客户端密钥(创建订阅时,您需要扩展 pending_setup_intent 属性)。然后,您需要在前端确认SetupIntent。要更好地了解 SetupIntents 的工作原理,您可以遵循以下指南:https:// stripe.com/docs/ payments/save-and-reuse?platform=web

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号