Back in the Setup a Stripe account chapter, we had two keys in the Stripe console. The Secret key that we used in the backend and the Publishable key. The Publishable key is meant to be used in the frontend.

We did not complete our Stripe account setup back then, so we don’t have the live version of this key. For now we’ll just assume that we have two versions of the same key.

Add the following line in the dev block of src/config.js.

STRIPE_KEY: "YOUR_STRIPE_DEV_PUBLIC_KEY",

And this in the prod block of src/config.js.

STRIPE_KEY: "YOUR_STRIPE_PROD_PUBLIC_KEY",

Make sure to replace, YOUR_STRIPE_DEV_PUBLIC_KEY and YOUR_STRIPE_PROD_PUBLIC_KEY with the Publishable key from the Setup a Stripe account chapter. For now they’ll be the same. Just make sure to use the live version in the prod block when you configure your Stripe account completely.

Commit the Changes

Let’s quickly commit these to Git.

$ git add .
$ git commit -m "Adding Stripe keys to config"

Next, we’ll build our billing form.