如何将 google 和 apple pay 添加到 stripe sesion node.js

问题描述 投票:0回答:0

我尝试在 node.js 和 angular 14 项目中集成 stripe checkout session,我只想添加 google 和 apple pay 作为支付方式。

这是我在 node.js 中的代码:

app.post('/create-checkout-session', async (req, res) => {
  const session = await stripe.checkout.sessions.create({
    payment_method_types: ['card'],
    line_items: [
      {
        price_data: {
          currency: 'usd',
          product_data: {
            name: 'My Product'
          },
          unit_amount: req.body.amount
        },
        quantity: 1
      }
    ],
    mode: 'payment',
    success_url: 'http://localhost:4200/success',
    cancel_url: 'http://localhost:4200/cancel'
  });

  res.json({ id: session.id });
});

node.js angular stripe-payments checkout
© www.soinside.com 2019 - 2024. All rights reserved.