I'm trying to integrate stripe to my organization's app, however, following stripe's own documentation, the way to integrate using nodeJS is by doing this:

<https://stripe.com/docs/billing/subscriptions/checkout#create-session>

I tried pretty much everything, but the server always throws a 404 error with the following message: "Cannot read property 'sessions' of undefined"

The thing is that when I console the stripe object in the backend I see that in fact there is no 'checkout' property for stripe, but the stripe docs say it does have it, which leads me to think that I must be doing something wrong.

This is my "go to checkout" button's frontend code

```
    const createCheckoutSession = (priceId:any) => {
        return axios.post("/create-checkout-session", {
          method: "POST",
          headers: {
            "Content-Type": "application/json"
          },
          body: JSON.stringify({
            priceId: priceId
          })
        }).then(function(result) {
          return result.data();
        });
      };

    const handleClick = async (event:any) => {
        // Get Stripe.js instance
        const stripe = await stripePromise;

        // Call your backend to create the Checkout Session
        //const response = await fetch('/create-checkout-session', { method: 'POST' });
        createCheckoutSession('price_1J7UmZFYFs5GcbAXvPronXSX').then(function(data) {
            // Call Stripe.js method to redirect to the new Checkout page
            stripe
              .redirectToCheckout({
                sessionId: data.sessionId
              })
              .then(()=>{console.log('handleResult')});
          })
          };

```

And here is my server.js code

```
//STRIPE CODE
const stripeKey = 'sk_test_51J7UfrFYFs5GcbAX45lXy6w2TV1hPqvUbqu3hdB4QRAXFR3QYmTgcNKXcVG7tL9vwaanjdYWGvkfiQ6Bd41dK4V7004yMs3Cbh'
const stripe = Stripe(stripeKey);

app.post('/create-checkout-session', async (req, res) => {
  //console.log("--------STRIPE----------", stripe);
  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://localhost:3000/success?session_id={CHECKOUT_SESSION_ID}',
      cancel_url: 'https://localhost:3000/canceled',
    });

    res.send({
      sessionId: session.id,
    });
  } catch (e) {
    res.status(400);
    return res.send({
      error: {
        message: e.message,
      }
    });
  }
});

```