如何解决基于订阅的产品的PaymentIntent
我正在后端中创建一个PaymentIntent,并且我需要知道如何将基于订阅的产品附加到所述的paymentIntent上,以便可以按一定间隔向客户收费。我看过的每个教程都使用Stripe Checkout而不是Stripe的paymentIntent api。这是我的代码:
app.post("/create-payment-intent",async (req,res) => {
const { items } = req.body;
// Create a PaymentIntent with the order amount and currency.
// How do I attach a product to the paymentIntent?
const paymentIntent = await stripe.paymentIntents.create({
amount: calculateOrderAmount(items),currency: "usd"
});
res.send({
clientSecret: paymentIntent.client_secret
});
});
任何帮助将不胜感激。
解决方法
您需要使用结算API,而不要使用付款方式:https://stripe.com/docs/billing/subscriptions/examples
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。