It looks like you are publishing your secret key instead of the publishable key. What does the code look like for how you are preparing and sending the code to Stripe?
Maybe you have the keys reversed in the env file?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
With modifying and adding my test credentials to my local .env file, I get this error anytime I try and do anything billable:
Uncaught Error: You are using a secret key with Stripe.js, instead of the publishable one. For more info, see https://stripe.com/docs/stripe.js
I followed the docs and tried to add my key, but it still didn't work. Any help?
All the stripe tokens start with either two strings:
sk_test_
or
pk_test_
The sk_test is the one that needs to be in your STRIPE_SECRET field and the pk_test one is the STRIPE_KEY. And yes you need to be using the Test api keys if your Stripe account is in test mode and the Live ones if it is in live mode.
I think that error is suggesting that you have the sk_test key in your STRIPE_KEY value.
Please or to participate in this conversation.