Set up Stripe webhook verification before you fulfill orders
A Stripe webhook tells your server about a payment event. Verify the sender before using the event to grant an entitlement or change an order.
npm install --save-dev @sitecmd/cli
npx sitecmd audit .
The CLI runs on your computer or in your CI, and your code stays there.
What it finds on a demo project
The CLI looks for a signature check and a duplicate-event guard in Stripe webhook handlers. In checkout code, it flags prices or return URLs taken from the request and sessions created without an idempotency key.
SiteCMD CLI 2.0.0
Demo project: Checkout and Stripe webhook endpoints
npx sitecmd audit .
SiteCMD Code Scan - .
Checked: November 9, 2026
Framework: Express
Issues: 5 total | critical 0 | high 3 | medium 2 | low 0
High (3)
- [Security · security] Possible client-controlled Stripe price selection - src/routes/checkout.js:20
- [Security · security] Possible client-controlled Stripe return URL - src/routes/checkout.js:21
- [Security · security] No recognized webhook signature verification in handler - src/routes/webhooks/stripe.js:9
Medium (2)
- [Operations · operations] No recognized idempotency policy for Stripe checkout creation - src/routes/checkout.js:18
- [Security · security] No recognized webhook idempotency guard in handler - src/routes/webhooks/stripe.js:9
Your code passes? Now watch your site.
Fix Stripe webhook signature verification failed errors
Verification needs the unchanged request body, the Stripe-Signature header and that endpoint's signing secret. If you parse JSON and rebuild the body, the bytes may differ from what Stripe signed. Stripe's signature error guide walks through each input.
Keep Stripe webhook idempotency separate from checkout retries
Stripe can deliver an event again. Track handled event IDs so a repeat delivery doesn't repeat fulfillment. Checkout creation has its own retries: use the same idempotency key when retrying the same order, so Stripe returns the first result rather than creating a second session.
Keep Stripe checkout prices and return URLs under server control
Match the visitor's product choice to an approved entry in your server's catalog. Build return destinations from routes you allow. Even if a request includes a price identifier or return address, the server still needs to decide whether to accept it.
Frequently asked questions
Does Stripe deliver webhook events in order?
No. The handler needs to retrieve any object it depends on when events arrive out of order, rather than relying on an earlier delivery.
How do I test Stripe webhook verification locally?
Use the Stripe CLI to forward test events to the local handler, then verify them with the signing secret for that forwarding session.
Review other webhook providers and order ownership
Website security
Catch leaked API keys and exposed files before someone uses them against you.
Webhook signature verification
Authenticate incoming provider messages before their handlers change state.
IDOR and tenant isolation
Look for app queries that trust an ID without checking who may use it.