Is a Stripe publishable key safe to expose?
A key is a long password your app uses to prove who it is to another service, here Stripe, which takes payments. Stripe's documentation says a publishable key can identify your account and create tokens or payment methods, but cannot perform sensitive operations such as creating charges or reading account data. (A token is a one-time code.)
Secret keys have unrestricted permissions and must stay on your back end, the part of your app that runs on the service's computers, where visitors cannot look. Stripe recommends restricted keys (rk_) for server code. Do not put keys in source code checked into version control, the saved history of your code.
A quick check: open your live page, view its source, and search for the letters sk_. A pk_ key showing up is normal. An sk_ or rk_ key showing up means you should replace it today (make a new one and turn the old one off) and move that call to the back end.
Sources
- Stripe documentation, API keys, accessed 2026-11-16