webhook

webhook is a skill for Claude Code from Venkateshwar-Reddy-Jambula/razorpay-integration-plugin. It costs 66 tokens per session (3,647 once invoked), scanned A, original, MIT.

A set of instructions for building a Razorpay payment webhook handler, which receives payment and subscription updates from Razorpay.

In plain words
What is it for?
Use it to verify webhook signatures, handle payment events, make processing idempotent, and respond correctly to Razorpay retries.
Why use it?
It helps prevent duplicate processing, unsafe requests, race conditions, unexpected event order, and failed deliveries from causing billing problems.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the razorpay plugin — 15 skills, 9 agents, 1 hook shipped together

Good fit Use it to verify webhook signatures, handle payment events, make processing idempotent, and respond correctly to Razorpay retries.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/venkateshwar-reddy-jambula/razorpay-integration-plugin/webhook
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Venkateshwar-Reddy-Jambula/razorpay-integration-plugin --skill webhook
Clone the repo
git clone --depth 1 https://github.com/Venkateshwar-Reddy-Jambula/razorpay-integration-plugin

Made for: Claude Code.

Or install razorpay, the plugin that ships this one along with the rest of its 15 skills, 9 agents, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for webhook

README.md
[![agentmods](https://agentmods.dev/badge/skills/venkateshwar-reddy-jambula/razorpay-integration-plugin/webhook/github.svg)](https://agentmods.dev/skills/venkateshwar-reddy-jambula/razorpay-integration-plugin/webhook)
Your own site
<a href="https://agentmods.dev/skills/venkateshwar-reddy-jambula/razorpay-integration-plugin/webhook"><img src="https://agentmods.dev/badge/skills/venkateshwar-reddy-jambula/razorpay-integration-plugin/webhook/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for webhook

Your own site · 80×15
<a href="https://agentmods.dev/skills/venkateshwar-reddy-jambula/razorpay-integration-plugin/webhook"><img src="https://agentmods.dev/badge/skills/venkateshwar-reddy-jambula/razorpay-integration-plugin/webhook.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,647 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00066 $0.03647
Opus 5.5 $0.00026 $0.01459
Sonnet 5.5 $0.00013 $0.00729
Haiku 4.5 $0.00007 $0.00365

Measured 1mo ago against content hash bdcef02672f7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

webhook scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/webhook/SKILL.md · 445 lines

How it starts

The opening of the file, as written. The whole thing — 445 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Razorpay Webhook Handler

Build a webhook handler that survives production chaos: duplicate events, race conditions, out-of-order delivery, and partial failures.

Critical Rules

  1. Always return 200 for events you don't handle — Razorpay retries on non-2xx
  2. Verify signature FIRST before any processing
  3. Idempotency is mandatory — Razorpay uses at-least-once delivery
  4. Never trust event order — subscription.charged may arrive before subscription.activated

Signature Verification

import crypto from "crypto";

function verifyWebhookSignature(rawBody: string, signature: string, secret: string): boolean {
  const expected = crypto
    .createHmac("sha256", secret)
    .update(rawBody)
    .digest("hex");

  // MUST use timing-safe comparison to prevent timing attacks
  try {
    return crypto.timingSafeEqual(
      Buffer.from(expected, "hex"),
      Buffer.from(signature, "hex")
    );
  } catch {
    return false; // Length mismatch = invalid
  }
}

Full Webhook Route

// app/api/billing/webhook/route.ts
import crypto from "crypto";

export async function POST(request: Request) {
  // 1. Read raw body (NOT parsed JSON — signature is computed on raw string)
  const rawBody = await request.text();
  const signature = request.headers.get("x-razorpay-signature");

  if (!signature) {
    return new Response("Missing signature", { status: 400 });
  }

  // 2. Verify signature
  const isValid = verifyWebhookSignature(
    rawBody,
    signature,
    process.env.RAZORPAY_WEBHOOK_SECRET!
  );

  if (!isValid) {
    return new Response("Invalid signature", { status: 400 });
  }

  // 3. Parse event
  const event = JSON.parse(rawBody);
  const eventType = event.event;

  // 4. Extract event ID (prefer header over payload)
  const eventId = request.headers.get("x-razorpay-event-id") || event.id || null;

  // 5. Extract subscription ID (multi-path — different event types store it differently)
  const subscriptionId = extractSubscriptionId(event);
  if (!subscriptionId) {
    // Non-subscription event (standalone payment, order, etc.) — acknowledge and skip
    return new Response("OK", { status: 200 });
  }

  // 6. Idempotency check (multi-layer)
  const subscription = await getSubscriptionByRazorpayId(subscriptionId);

  // Layer 1: Exact event ID match (same event delivered twice)
  if (subscription?.lastEventId === eventId && eventId) {
    return new Response("Already processed", { status: 200 });
  }

  // Layer 2: Check processed_events table for this event ID
  // Razorpay can send the same logical event with different event IDs on retry
  if (eventId) {
    const alreadyProcessed = await db
      .select()
      .from(processedWebhookEvents)
      .where(eq(processedWebhookEvents.eventId, eventId))
      .limit(1);
    if (alreadyProcessed.length > 0) {
      return new Response("Already processed", { status: 200 });
    }
  }

  // 7. Handle event
  try {
    await handleEvent(eventType, event, subscription, eventId);

    // Record processed event for idempotency
    if (eventId) {
      await db.insert(processedWebhookEvents).values({
        eventId,
        eventType,
        subscriptionId,
        processedAt: new Date(),
      }).onConflictDoNothing();  // Safe if duplicate insert races
    }
  } catch (error) {
    console.error("Webhook processing error:", error);
    // Still return 200 to prevent retries on app errors
    // Log for manual investigation
  }

  return new Response("OK", { status: 200 });
}

// Subscription ID lives in different places depending on event type
function extractSubscriptionId(event: any): string | null {
  return (
    event.payload?.subscription?.entity?.id ||
    event.payload?.payment?.entity?.subscription_id ||
    event.payload?.invoice?.entity?.subscription_id ||
    null
  );
}

Read the full file on GitHub · 445 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 445 lines · 66 tokens per session scan A bdcef02672f7

Subscribe to this mod's changes

webhook is a skill published in the GitHub repository Venkateshwar-Reddy-Jambula/razorpay-integration-plugin (6 stars, last pushed 7mo ago), licensed MIT. It adds 66 tokens to every session and 3,647 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

convex-billing

Add Stripe billing/payments to the Convex app via @convex-dev/stripe (checkout + webhook + gating).

openclaw/clawhub · 29 tokens

cloudbase-wechat-integration

A guide for connecting CloudBase applications to WeChat services, including payments, official accounts, and user identity.

TencentCloudBase/CloudBase-AI-Toolkit · 94 tokens

shopify-admin

Write or explain Admin GraphQL queries and mutations for apps and integrations that extend the Shopify admin. Use when the user wants to understand, design, or generate the operation itself—even before deciding how to run it. Do not choose admin first for app monetization—charging merchants for the app itself via app…

Shopify/Shopify-AI-Toolkit · 226 tokens

shopify-functions

Shopify Functions allow developers to customize the backend logic that powers parts of Shopify. Available APIs: Discount, Cart and Checkout Validation, Cart Transform, Pickup Point Delivery Option Generator, Delivery Customization, Fulfillment Constraints, Local Pickup Delivery Option Generator, Order Routing Location…

Shopify/Shopify-AI-Toolkit · 61 tokens

baselinker-webhooks

Receive BaseLinker (Base.com) webhooks. Use when building a BaseLinker order or warehouse callback receiver, because BaseLinker is not a normal webhook source: deliveries arrive as HTTP HEAD requests with NO body, the entire payload is in the query string (observed params: orderid, state), there is NO signature…

hookdeck/webhook-skills · 131 tokens

whatnot-webhooks

Receive and verify Whatnot webhooks (whatnot.com — the live-shopping and livestream-auction marketplace). Use when building a Whatnot Seller API app that handles webhook topics like order/created, order/updated, product/sold, listing/created, livestream/stopped or bulkoperation/finished, or when debugging…

hookdeck/webhook-skills · 136 tokens