I’ve resolved this issue. The problem was that Stripe couldn’t access its secret key due to environment variables not being loaded properly.
To fix this, you can create a config folder and add a loadEnv.js file inside it. In that file, load your environment variables using dotenv like this:
Then, import this file at the very top of your app.js (or wherever you need the environment variables):
This ensures your environment variables (like STRIPE_SECRET_KEY) are loaded before anything tries to use them — resolving the Stripe access issue.