# Webhook Security & Idempotency Review (Stripe and more)

> Audit and fix webhook endpoints for Stripe, GitHub, Shopify, WhatsApp, Twilio and custom gateways: signature checks on the raw body, replay protection, exactly-once processing, fast acknowledgement and reconciliation. Stops forged events and double orders.

Webhook Security & Idempotency Review (Stripe and more) is a paid AI agent skill on Agensi by Hayder Al-Hwaidi, in APIs & Backend. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Hayder Al-Hwaidi](https://www.agensi.io/creators/hayder-al-hwaidi)
- Category: [APIs & Backend](https://www.agensi.io/skills/apis-backend)
- Version: 1.0.0
- Last updated: 2026-12-01
- Security: scan passed (2026-12-01); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/webhook-security-idempotency-review-stripe-and-more
- Tags: webhooks, stripe, payments, security, idempotency, nextjs, express, backend

## About this skill

Webhook bugs are silent and expensive. A missing signature check lets anyone spoof a payment, while a slow handler causes timeouts and duplicate orders. This skill audits your webhook routes to ensure they are secure, idempotent, and resilient against provider retries.

### What it does
- **Signature verification** ensures the handler validates provider secrets before triggering any side effects.
- **Raw body handling** fixes verification failures caused by pre-parsed JSON middleware.
- **Idempotency implementation** prevents duplicate processing of retried events using unique constraints.
- **Timing-safe comparison** adds constant-time HMAC checks to prevent sensitive data leaks.
- **Asynchronous processing** refactors slow handlers to acknowledge events quickly before performing heavy tasks.
- **State reconciliation** drafts scheduled jobs to recover from missed events or provider outages.

### How it works
1. **Inventory endpoints** by searching the codebase for provider SDK calls, signature headers, and callback routes.
2. **Audit handlers** against eight critical failure points including timestamp tolerance, out-of-order safety, and payload trust.
3. **Rewrite code** using verified patterns for your specific framework and provider.
4. **Generate migrations** for the idempotency tables required to track processed event IDs.

### Frameworks & tools
This skill works with Next.js, Express, Fastify, Supabase Edge Functions, and Django. It identifies issues with Stripe, Paddle, PayPal, GitHub, Shopify, WhatsApp/Meta, and Twilio SDKs.

### Why this beats prompting it yourself
Generic prompts often miss the "raw body" requirement in frameworks like Next.js, leading to broken signatures. This skill follows a strict 8-point checklist that covers edge cases like event replay attacks and out-of-order state updates that manual prompting usually ignores.

### Use cases
- Audit Stripe webhook routes in Next.js for signature and duplicate handling.
- Fix orders being created twice when a payment provider retries a request.
- Add HMAC verification to a custom payment gateway callback.
- Refactor a slow webhook that times out under heavy load.

### Known limitations
Requires access to the backend route handlers and database schema. It cannot fix issues residing solely within third-party provider dashboards.

## Requires

- Backend with webhook endpoints
- Optional: Stripe CLI (for replay tests)

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Webhook Security & Idempotency Review (Stripe and more) skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What specific security and reliability issues does this skill address?

This skill audits your webhook endpoints against eight critical failure points including signature verification, raw body handling, and idempotency to prevent silent errors like duplicate orders or security spoofs.

### What do I need to provide for this skill to work?

You need to provide your AI agent with access to your backend route handlers and database schema, as the skill needs to review your code and generate migrations for idempotency tables.

### What kind of output will I receive after the review?

For each endpoint, you will receive a table detailing checks and failures with code references, followed by rewritten handler code and necessary database migrations to track processed event IDs.

### Are there any limitations to what this skill can fix?

This skill cannot fix issues that reside solely within third-party provider dashboards, such as Stripe or PayPal settings, and it requires direct access to your codebase to function.

### How should I instruct my AI agent to start using this skill?

You can ask your agent to audit specific routes like your Stripe webhook in Next.js for duplicate handling, or request it to add HMAC verification to a custom payment gateway callback.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
