Add a Stripe API Key as an Environment Variable in Next.js & Vercel

InstructorColby Fayock

Share this video with your friends

Send Tweet

With Stripe or many other services, their APIs rely on special keys that authenticate requests or allow that service to track usage for things like billing.

Some of these keys are able to be used publicly and some must be kept private, but ultimately we want to have a way to easily manage these keys and not hard-code them into our application, which is where environment variables come in.

We will find our Stripe public key that will be used locally as well as in production on Vercel. You'll learn how to set an environment variable in Next.js (hint, you need to prepend NEXT_PUBLIC to the variable name make it available in the client) as well as in production on Vercel.

Navneet Kumar Sharma
~ 3 years ago

Would it be a viable solution to add 1000s products in stripe in case of real eCommerce application which can easily have 1000s products?

Colby Fayockinstructor
~ 3 years ago

Would it be a viable solution to add 1000s products in stripe in case of real eCommerce application which can easily have 1000s products?

Good question. I haven't dealt with that many products using Stripe before. My guess would be that someone that needs to manage a large scale of products could use the Stripe API to programmatically create products as they were being managed in a separate management system.