小编Mak*_*pov的帖子

Stripe“缺少必需参数:line_items[0][货币]。” 节点js

我正在 Node js 后端创建订阅。它一直工作得很好,但今天我收到了这个错误。我没有对代码进行任何更改 - 它只是开始返回此错误。后端代码:

 app.post('/api/subscription', async (req, res) => {
  const { priceId } = req.body;
  
  try {
    const session = await stripe.checkout.sessions.create({
      mode: "subscription",
      payment_method_types: ["card"],
      line_items: [
        {
          price: priceId,
          // For metered billing, do not pass quantity
          quantity: 1,
        },
      ],
      // {CHECKOUT_SESSION_ID} is a string literal; do not change it!
      // the actual Session ID is returned in the query parameter when your customer
      // is redirected to the success page.

      success_url: 'https://someurl',
      cancel_url: …
Run Code Online (Sandbox Code Playgroud)

node.js stripe-payments

5
推荐指数
1
解决办法
9065
查看次数

标签 统计

node.js ×1

stripe-payments ×1