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.