首页  >  问答  >  正文

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>
P粉441076405P粉441076405434 天前452

全部回复(1)我来回复

  • P粉757556355
  • 取消回复