【发布时间】:2020-09-10 00:50:09
【问题描述】:
我收到控制台消息:
“IntegrationError: stripe.redirectToCheckout: 您必须提供 lineItems、items 或 sessionId 之一。”
我相信 sessionId 是空的,因为 response.data 是来自 console.log(response.data) 的“空字符串”。
此代码来自一个教程的 github。它应该非常接近正确,但我认为有一点不准确。
stripe.checkout.sessions.create({
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
payment_method_types: ["card"],
line_items: results
}, function(err, session) {
response.send(session)
});
axios.get('https://us-central1-webstore-vuejs.cloudfunctions.net/CheckoutSession', {
params: {
products: data
}
}).then(response => {
this.sessionId = response.data
console.log(response.data)
stripe.redirectToCheckout({
sessionId: this.sessionId.id
}).then(function(result) {
});
})
【问题讨论】:
标签: vue.js axios stripe-payments checkout