Test Stripe webhooks
Get a public URL for Stripe to send events to, see each event as it arrives, check its Stripe-Signature with your signing secret, and forward it to your local server. Free, no signup.
Get a webhook URLAdd the URL in Stripe
- Open webhookcat.com, copy your URL and add
/webhooks/stripeto the end. Sub-paths are kept when requests are forwarded, so this one reaches the route in the code below. - In the Stripe Dashboard, open Workbench, go to the Webhooks tab and click Create an event destination.
- Choose the events you want, select Webhook endpoint as the destination type, and paste your WebhookCat URL as the Endpoint URL.
- Trigger an event, for example with
stripe trigger payment_intent.succeededfrom the Stripe CLI, or by making a payment in a sandbox.
What Stripe sends
- Stripe-Signature
- A timestamp
t=and one or morev1=signatures, each an HMAC-SHA256 of the timestamp, a dot and the body. - Content-Type
application/json- User-Agent
- Starts with
Stripe/1.0.
Check the signature
Open a request in WebhookCat and paste the secret into the Signature box under it. You'll see right away whether it matches. The check runs in your browser, and the secret is never sent or saved.
On the endpoint's page in Workbench, click Reveal secret and copy the value that starts with whsec_. The secret printed by stripe listen belongs to the CLI, not to this endpoint.
The same check in your own Node.js server:
import express from "express";
import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
const app = express();
// Keep the raw body: re-serialized JSON no longer matches the signature.
const raw = express.raw({ type: "application/json" });
app.post("/webhooks/stripe", raw, (req, res) => {
let event;
try {
event = stripe.webhooks.constructEvent(
req.body,
req.get("stripe-signature"),
process.env.STRIPE_WEBHOOK_SECRET,
);
} catch (err) {
return res.status(400).send(`Webhook error: ${err.message}`);
}
console.log(event.type);
res.sendStatus(200);
});Forward to your local server
In the inbox you pasted into Stripe, open Share and run the command shown there. It forwards each request to localhost:3000/webhooks/stripe with the same headers and body, so the signature check in your code passes too. Needs Node.js 22 or later.
$ npx webhookcat listen 3000 --inbox "https://webhookcat.com/#<id>/<key>"Starting from the terminal instead? npx webhookcat listen 3000 creates a new URL and prints it. Paste that URL plus /webhooks/stripe into Stripe. More in the docs.
Good to know
- Sandbox events also carry a
v0=signature. It isn't valid for verification, and WebhookCat ignores it. - Stripe's libraries reject events signed more than five minutes earlier. WebhookCat shows that gap next to a valid signature.
- Redirects and responses outside 2xx count as failures. Stripe retries for up to three days in live mode and three times over a few hours in a sandbox, so a 500 set as the response in WebhookCat lets you watch the retries.