00 / guide
Rotate a Stripe API key or webhook secret without breaking checkout
A key leaked, a teammate left, or Stripe emailed you about an exposed key. You need new secrets now, but you don't want checkout or webhooks to go dark while you swap them. There are two different secrets to change, and each has its own way to overlap old and new.
Free tool: which key is which before you swap them
01 / what CheckoutAlarm checks
a
What it would catch here
If the new signing secret isn't live on your server, your endpoint rejects events and they stay undelivered. CheckoutAlarm emails you at its next Stripe check (once a day on Free, hourly on Pro) when events are still undelivered after about 15 minutes. If you rotate the read-only key you gave CheckoutAlarm, it emails you that Stripe rejected that key, so you can paste the new one.
b
What it won't catch
It never sees your server's own Stripe calls or your environment variables. If your app's secret key is wrong and every checkout fails, it only notices through the stalled-sales check, at its next Stripe check after 48 hours with no successful charges, and only if the previous 14 days had steady sales. A new store won't trigger it.
c
Plans
Free: 1 site, checked once a day. Pro: $19 a month, up to 3 sites checked hourly. You prove you own the site first. For Stripe we only take a restricted key with read access to Events, Webhook Endpoints and Charges. Full secret keys are refused. Compare plans
02 / two different secrets
1
API keys
Publishable (pk_), secret (sk_) and restricted (rk_) keys are on the API keys page, with separate keys for sandbox and live mode. Stripe: API keys Your server uses the secret or restricted key to create Checkout Sessions.
2
Webhook signing secrets
Each webhook endpoint has its own whsec_ secret, which your server uses to check that an event came from Stripe. You roll it on the endpoint, not on the API keys page. Stripe: roll endpoint secrets Rotating API keys doesn't change it, so a leak of your environment variables means changing both.
03 / rotate the API key
1
If it leaked, rotate now
Stripe says to rotate a restricted or secret key right away if it was exposed, even if you aren't sure anyone saw it. Stripe: handle compromised keys
2
Rotate in the Dashboard
On the API keys page, open the menu (⋯) next to the key, choose Rotate key, and pick an expiration. Copy the new key and save it: you can't see it again later. Stripe: rotate an API key
3
Pick the expiration on purpose
If you choose Now, the old key is deleted at once. Stripe: rotate an API key A call made with an expired key gets an authentication error, so checkout fails until the new key is deployed. Stripe: API keys If you choose a later time, both keys work for up to 7 days while you move over. Stripe: rotate safely
4
Deploy the new key
Put the new key in your host's environment variables and redeploy. On Vercel, a changed variable applies only to new deployments, not ones already running. Vercel: environment variables
5
Watch the old key go quiet
Each key has request logs in Workbench. Stripe suggests expiring the old key only after its request volume has been at zero for a few hours or days. Stripe: view request logs Stripe: rotate safely
04 / roll the webhook signing secret
1
Roll it with an overlap
In Workbench, open the Webhooks tab, click the endpoint, open the menu (⋯) and click Roll secret. You can expire the current secret at once or delay it for up to 24 hours. While both are active, Stripe signs each event once per secret, so the old code keeps verifying. Stripe: roll endpoint secrets
2
Update every endpoint you use
Roll the secret on each endpoint whose secret may have leaked, and update the matching variable (often STRIPE_WEBHOOK_SECRET). Test and live endpoints have different secrets. More in works in test mode but not live.
3
Deploy before the old one expires
Redeploy with the new secret inside the overlap. If the old secret expires first, your handler rejects every event with a signature error. That looks like signature verification failed.
05 / check nothing was lost
1
Look at Event deliveries
Your endpoint's Event deliveries tab shows failed deliveries and when the next retry is. In live mode Stripe retries for up to three days. Stripe: automatic retries
2
Resend what failed
Once the new secret is live, click Resend on a failed event in the Dashboard (up to 15 days after it was created), or use stripe events resend in the Stripe CLI (up to 30 days). Stripe: manual retries
3
Make one real test
Run one checkout end to end and confirm your app unlocked it. If it didn't, see paid but not unlocked.
06 / questions
- Is the webhook signing secret one of my API keys?
- No. API keys (pk_, sk_, rk_) live on the API keys page. Each webhook endpoint has its own signing secret (whsec_), and you roll it on that endpoint in Workbench. Rotating API keys doesn't change it.
- Will rotating my Stripe key break checkout?
- Only if your server still uses the old key after it expires. When you rotate in the Dashboard you pick when the old key expires. Pick Now and the old key is deleted at once, so calls with it fail until the new key is deployed.
- How long can the old webhook secret keep working?
- When you roll a signing secret you can expire the old one now or delay it for up to 24 hours. Until then Stripe signs each event once per active secret.
- Does CheckoutAlarm tell me if a rotation broke something?
- If your endpoint starts rejecting events, its failed-delivery check emails you at its next Stripe check (once a day on Free, hourly on Pro) once events are still undelivered after about 15 minutes. If you rotate the read-only key you gave CheckoutAlarm, it emails you that Stripe rejected the key. It never sees your server's own Stripe calls or your environment variables.
07 / where CheckoutAlarm fits
CheckoutAlarm can't see your keys or your server's Stripe calls. It emails you when events stay undelivered after a secret swap, when the read-only key you gave it stops working, and, if steady sales stop for 48 hours, at its next Stripe check.
CheckoutAlarm is new. It only checks sites you prove you own. How to verify
Watch my app free08 / sources
- Stripe: API keys (modes, expired key error)
- Stripe: rotate an API key in the Dashboard
- Stripe: rotate safely to avoid downtime (7-day overlap)
- Stripe: view request logs
- Stripe: handle compromised API keys
- Stripe: roll endpoint secrets (up to 24 h)
- Stripe: automatic retries (3 days, live)
- Stripe: manual retries (Resend, CLI)
- Vercel: environment variables (new deployments only)
Docs checked on Oct 21, 2026.