'A way to use the Stripe API to authenticate customers to get a Stripe Customer Portal integration to work?

Stripe Customer Portal docs tell us to use this:

app.post('/create-customer-portal-session', async (req, res) => {
  // Authenticate your user.
  const session = await stripe.billingPortal.sessions.create({
    customer: '{{CUSTOMER_ID}}',
    return_url: 'https://www.seedsgives.com/thanks-for-giving',
  });

  res.redirect(session.url);
});

....but I need to first find a way to authenticate our customers using the customer ID already stored within our Stripe account, or this doesn't work.

I assume I can pull this info using the Stripe API, but am at a loss as to how to do so. Can anyone help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source