stripe-webhook-signature-verification

Verify Stripe webhook HMAC signatures in Node.js and Next.js handlers.

1|Updated May 6, 2026
One-click install
npx skills add https://github.com/jacob-balslev/skill-graph --skill stripe-webhook-signature-verification
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stripe-webhook-signature-verification
Source: https://github.com/jacob-balslev/skill-graph/tree/main/examples/projects/saas-stripe-postgres/skills/stripe-webhook-signature-verification
Command: npx skills add https://github.com/jacob-balslev/skill-graph --skill stripe-webhook-signature-verification

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents unauthenticated or tampered Stripe webhook requests from triggering payment processing by verifying the request’s HMAC signature and rejecting stale/replayed deliveries.

Core Features & Use Cases

  • Stripe HMAC-SHA256 signature verification: Confirms the stripe-signature header matches STRIPE_WEBHOOK_SECRET using Stripe’s constructEvent flow.
  • Replay attack protection: Enforces Stripe’s timestamp tolerance window so old events are rejected.
  • Idempotency-friendly processing: Supports the event.id pattern to avoid double-processing retries safely.

Quick Start

Use this skill to authenticate incoming Stripe webhook requests in your Node.js or Next.js backend by verifying the raw request body against the stripe-signature header with STRIPE_WEBHOOK_SECRET before handling the payment event.

Frequently Asked Questions about stripe-webhook-signature-verification

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify a Stripe webhook signature in Node.js?

To verify a Stripe webhook signature in Node.js, you validate the HMAC-SHA256 signature in the stripe-signature header against your STRIPE_WEBHOOK_SECRET using the constructEvent flow. This requires passing the raw, unparsed request body to ensure the cryptographic check succeeds.

Why does Stripe webhook verification fail in Next.js App Router?

Stripe webhook verification fails in Next.js App Router when the request body is parsed before signature validation. You must access the raw, unparsed request body to use Stripe's constructEvent method, as JSON parsing alters the payload and breaks the HMAC-SHA256 signature match.

How does Stripe webhook replay protection work?

Stripe webhook replay protection works by enforcing a timestamp tolerance window on incoming events. This mechanism rejects stale or previously delivered webhook requests, preventing attackers from replaying old payloads to trigger duplicate payment processing.

Do I need to handle idempotency if I verify Stripe webhooks?

Yes, you should handle idempotency even when verifying Stripe webhooks to prevent double-processing retries. Using the event.id pattern allows your handler to safely process retried webhook deliveries without duplicating payment routing or side effects.

What happens when Stripe webhook signature verification cannot be completed?

When Stripe webhook signature verification cannot be completed, the handler cleanly fails by returning a 400 response. This blocks unauthenticated or tampered webhook requests from triggering any downstream payment processing or routing logic.

Can I use this Stripe webhook signature verification with any Node.js framework?

Yes, this Stripe webhook signature verification applies to any Node.js or Next.js backend handler. It requires frameworks that allow raw, unparsed request body access to successfully execute the constructEvent validation against the STRIPE_WEBHOOK_SECRET.