Guides · Updated December 2, 2026
Where to find your Stripe webhook secret (whsec_)
Your webhook handler needs a value that starts with whsec_, usually stored as STRIPE_WEBHOOK_SECRET. Stripe calls it the endpoint's signing secret. It isn't on the API keys page, and you can't copy it from your secret key. Each webhook endpoint has its own, and Stripe shows it in three places depending on how the endpoint was created. This page is about getting the right one into your app. If you rotated or rolled secrets and events started failing, use Rotated your Stripe keys? Check your webhook secret instead.
The short answer
- In the Stripe Dashboard, open Workbench and go to the Webhooks tab.
- Make sure you're looking at the right mode: live for your production app, a sandbox or test mode for testing.
- Select the endpoint whose URL your app receives events on.
- Click Reveal secret and copy the
whsec_…value (Stripe: Retrieving your endpoint's secret).
If the Webhooks tab has no endpoint, there's no secret to find yet. Stripe creates one when you add an endpoint: Create an event destination, choose the event types, choose Webhook endpoint, and enter your URL. The signing secret appears on the endpoint's settings page when you're done (Stripe: Create an event destination).
Webhook secret vs API keys
Stripe keeps these separate (Stripe: API keys):
- API keys (
sk_…,rk_…,pk_…) authenticate requests your server makes to Stripe. They live on the API keys page. - Webhook signing secrets (
whsec_…) let your webhook handler check that a request from Stripe is genuine. Stripe's docs say they aren't API keys: each endpoint has its own, under that endpoint in the Webhooks section.
Putting sk_… in STRIPE_WEBHOOK_SECRET, or a whsec_ in STRIPE_SECRET_KEY, is a common copy-paste mistake. Your handler then fails verification on every event.
Which secret your app needs
All of these start with whsec_, which is why they're easy to mix up:
- Dashboard endpoint, live mode. This is the one your production deployment needs.
- The same URL in test mode or a sandbox. Stripe generates a unique secret per endpoint, and an endpoint used with both test and live API keys has a different secret in each (Stripe: Webhooks).
- Stripe CLI.
stripe listenprints its own secret when it starts ("Ready! Your webhook signing secret is whsec_…").stripe listen --print-secretprints only the secret and exits, and Stripe says it doesn't change between restarts oflisten(Stripe CLI: listen). Use it for local development only. Stripe says mixing up the CLI secret and a Dashboard endpoint's secret is the most common cause of signature errors (Stripe: Check the endpoint secret). - More than one endpoint. Each endpoint has its own secret. If you have an old endpoint and a new one (for example after moving from a preview URL to your production domain), use the secret of the endpoint that points at the URL actually receiving events.
Endpoints created with the API
For a webhook endpoint created with the v1 API, the secret field is only returned at creation (Stripe API: The Webhook Endpoint object). If you didn't save it, reveal it in Workbench. For the v2 Event Destinations API, Stripe's docs show adding webhook_endpoint.signing_secret to include when you create the destination; the response then contains the whsec_ value (Stripe: Create an event destination).
Where to put it
- Server-side only. Store it as an environment variable read by the webhook route, never in source control and never in browser code. In Next.js, don't give it a
NEXT_PUBLIC_prefix; in Vite, don't give it aVITE_prefix. Both prefixes are for values the browser can see. - Supabase Edge Function: set it as a function secret (for example
supabase secrets set STRIPE_WEBHOOK_SECRET=whsec_…), not in client-side code. - Vercel or another host: set it for the Production environment and redeploy. A running deployment keeps the value it was built or started with.
- Copy it exactly. Stripe's troubleshooting steps say to confirm the value your code uses has no extra whitespace (Stripe: Check the endpoint secret). Quotes pasted into a dashboard field cause the same problem.
Check that your app has the right one
Don't print the whole secret. Log a few safe facts about it, send a test event, and compare the last four characters with the secret you revealed in Workbench:
// Temporary, in your webhook route. Remove it after you've compared. Never log the full secret.
const s = process.env.STRIPE_WEBHOOK_SECRET ?? "";
console.log({
set: s.length > 0,
startsWithWhsec: s.startsWith("whsec_"),
hasStrayWhitespaceOrQuotes: s !== s.trim() || /^["']|["']$/.test(s),
last4: s.slice(-4),
});Stripe may also add optional debug entries to the Stripe-Signature header: secret is a redacted form of the endpoint's newest active signing secret, and destination is the ID of the endpoint it belongs to (we_… or ed_…). If they're present, they tell you which endpoint signed the request and whether its secret ends in the same characters as yours. Stripe says not to use them for verification; only a valid v1 signature authenticates a request (Stripe: Verify webhook signatures manually).
If the secret matches and verification still fails, the usual cause is a changed request body: Stripe needs the exact raw body, and frameworks that parse JSON before your handler break the signature (Stripe: Check the request body). If Stripe shows the event as Delivered but your app didn't change, the secret is fine and the problem is in the handler: see Stripe webhook not firing and paid but no access.
What PaidCheck's free report checks
PaidCheck can't see your environment variables or which whsec_ your server uses. With a read-only restricted key, the free report flags events from the last 30 days that Stripe hasn't delivered to an endpoint, disabled endpoints, endpoints missing subscription or checkout events, and a missing endpoint. Add a user list (CSV, Supabase function or HTTPS endpoint) to also see paying users who are locked out and canceled, unpaid or past_due users who still have access, which is what a wrong secret usually leads to. It never writes to Stripe or your app. Paid plans run these checks daily and send an alert email when a check finds a new issue.
See what a bad webhook secret cost you
Run the free leak report with a read-only restricted key to find undelivered events and users whose access doesn't match Stripe. The key is used once and not stored.
Run the free leak report →FAQ
Where do I find my Stripe webhook secret?
In the Stripe Dashboard, open Workbench, go to the Webhooks tab, select the endpoint, and click Reveal secret (Stripe's docs also call it Click to reveal). The value starts with whsec_. Each endpoint has its own secret, so pick the endpoint whose URL your app actually receives events on.
Is the webhook secret the same as my Stripe secret key?
No. Stripe's docs say webhook signing secrets aren't API keys. API keys (sk_, rk_, pk_) authenticate requests your server makes to Stripe. The whsec_ signing secret lets your webhook handler check that a request really came from Stripe. You'll usually store it in its own variable, such as STRIPE_WEBHOOK_SECRET.
Why is my webhook secret different in test mode and live mode?
Stripe generates a unique secret for each endpoint, and if you use the same endpoint for test and live API keys the secret is different for each one. Your live deployment needs the live endpoint's secret.
Where is the secret when I test locally with the Stripe CLI?
stripe listen prints it when it starts ("Your webhook signing secret is whsec_..."). stripe listen --print-secret prints only the secret and exits. Stripe's docs say it doesn't change between restarts of the listen command. It's a different secret from any Dashboard endpoint, so don't deploy it to production.
I created the endpoint with the API. Can I fetch its secret again later?
For a webhook endpoint created with the v1 API, Stripe's API reference says the secret field is only returned at creation. If you didn't save it, open the endpoint in Workbench and reveal it there. With the v2 Event Destinations API, Stripe's docs show adding webhook_endpoint.signing_secret to include when you create the destination.
Can PaidCheck read my webhook secret?
No. PaidCheck reads Stripe through a read-only restricted key and never sees your server's environment variables or your whsec_ value. Its free report shows the effects of a broken webhook (events not delivered in the last 30 days, a disabled endpoint, missing event types, and with a user list, people whose access doesn't match Stripe). Paid plans run these checks daily and send an alert email when a check finds a new issue.
Related guides
- Rotated your Stripe keys? Check your webhook secret
API keys and webhook signing secrets are separate. How to spot a wrong whsec_, redeploy, resend missed events and check what changed while verification failed.
- Bolt Stripe subscription not updating: fix access in your Bolt app
When a Bolt app doesn't grant or revoke access after a Stripe subscription change: a prompt to paste into Bolt, and the Stripe checks that go with it.
- Lovable Stripe webhook not working: how to fix it in Lovable
How to get a Stripe webhook working in a Lovable app: a production URL, a prompt to paste into Lovable, and the Stripe Dashboard checks to run after.
- Stripe subscription past_due but the user still has access: what to do
A renewal failed and the customer still has the paid plan. What past_due means, the usual bugs, a policy, the code, and what happens after Stripe's last retry.
Check your own Stripe account for these issues. Run a free leak report →
Check your own account
PaidCheck's free leak report runs these comparisons with a read-only Stripe restricted key. Upload a CSV of your users or skip that for Stripe-only checks. The key is used once and not stored.
Run a free leak report →