0

I tried to integrate stripe checkout session in node.js and angular 14 project, all I want is to add google and apple pay as a payment method.

this is my code in 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 });
});

1 Answers1

0

Apple Pay and Google Pay are already included when you pass payment_method_types: ['card'] in your code. Stripe does not treat those as separate payment method types in their API.

As long as you have Apple Pay and Google Pay enabled in your Stripe account here in the Wallets section then it should then just work on Checkout.

If you don't see those buttons, it's likely because the device you are using doesn't support Apple Pay or Google Pay. You need to make sure you use a compatible device like an iPhone + Safari and have a valid card configured in the wallet already. You can visit Stripe's doc page here to confirm whether the button works fine on the device you're on.

koopajah
  • 23,792
  • 9
  • 78
  • 104