Stripe - PaymentIntent 需要 Node.js 中的付款方式問題
<p>我正在嘗試將 stripe 整合到我的專案中,但收到“<strong>PaymentIntent 需要付款方式</strong>”訊息。日誌中的付款狀態代碼是200。但在付款儀表板中顯示“未完成”,原因是“<strong>客戶尚未輸入他們的付款方式。</strong>”</p>
<p><strong>下面是我的條紋後端代碼</strong></p>
<pre class="brush:php;toolbar:false;">exports.StripePayment = (req, res) => {
const { amount, token } = req.body;
const idempotencyKey = uuid();
return stripe.customers
.create({
email: token.email,
source: token.id,
})
.then((customer) => {
stripe.paymentIntents
.create(
{
amount: amount,
currency: "INR",
payment_method_types: ["card"],
customer: customer.id,
receipt_email: token.email,
shipping: {
name: token.card.name,
address: {
line_1: token.card.address_1,
line_2: token.card.address_2,
city: token.card.address_city,
country: token.card.address_country,
postal_code: token.card.address_zip,
},
},
},
{ idempotencyKey }
)
.then((result) => {
console.log("Result", result);
return res.status(200).json(result);
})
.catch((err) => console.log(err));
});
};</pre>
<p>需要幫助來修復。提前致謝</p>