问题描述
我正在尝试测试为条带订阅创建结帐会话的过程。但是,我在客户端收到此错误:IntegrationError: stripe.redirecttocheckout: 您必须提供 lineItems、items 或 sessionId 之一。
这是我在前端的代码:
.asciz "\n"
var priceId = "price_1IGpOIFE3UXETakjtSs1Wq6x";
var createCheckoutSession = function(priceId) {
return fetch("https://us-central1-streamline-14fc8.cloudfunctions.net/createCheckoutSession",{
method: "POST",headers: {
"Content-Type": "application/json"
},body: JSON.stringify({
priceId: priceId
})
}).then(function(result) {
return result.json();
});
};
document
.getElementById("checkout")
.addEventListener("click",function(evt) {
createCheckoutSession(priceId).then(function(data) {
// Call Stripe.js method to redirect to the new Checkout page
console.log(data);
stripe
.redirecttocheckout({
sessionId: data.sessionId
})
.then(handleResult);
});
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)