vibehowto

Home / Passwords & API keys / API keys, one company at a time / Stripe API keys

Stripe API keys

Updated Sep 18, 2026

pk_ vs sk_, test vs live. Secret stays off NEXT_PUBLIC_. Same names in .env and Vercel.

You will leave with test-mode Stripe keys in .env and Vercel. Two keys, two jobs:

KeyPrefixGoes in
Publishablepk_test_ or pk_live_Browser is allowed. NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
Secretsk_test_ or sk_live_Server only. STRIPE_SECRET_KEY. Never NEXT_PUBLIC_

Webhooks are a third secret. That is the next page.

Step 1: Dashboard

Sign in at dashboard.stripe.com. Test mode toggle on (upper right) until you have a real customer.

Developers → API keys, or open dashboard.stripe.com/apikeys.

Copy the publishable key. Reveal and copy the secret key. Live secrets are shown once; test secrets can be revealed again. Still treat both as passwords.

Step 2: Names

.env.example:

Terminal
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=

.env:

Terminal
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_SECRET_KEY=sk_test_...

Vercel: both names, Production (and Preview if you test deploys). Redeploy after adding them. NEXT_PUBLIC_ values are baked in at build time — a new deploy is required.

Optional: Stripe CLI later for local webhooks. Not required to copy keys.

Next: Stripe webhook secret.

Checklist

Saved in this browser. No account. Clearing site data wipes it.

Next: Stripe webhook secret

Get new guides and videos by email

One email when something new is up. No spam. Unsubscribe anytime.