Skip to content
Back to skills

Razorpay

ASecurity

> **Verification Tier:** `code_example_tested` | **Last Verified:** 2026-11-18 > **Official Docs:** https://razorpay.com/docs/api/

  • 13 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentsbashapidatabasefrontendsecurity

Works with

  • cli
  • api

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 2 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add ashish7802/awesome-api-skills --skill razorpay --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Razorpay?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Razorpay
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ashish7802-razorpay/badge)](https://www.skillsdirectory.com/skills/ashish7802-razorpay)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Razorpay API & SDK Skill

> **Verification Tier:** `code_example_tested` | **Last Verified:** 2026-11-18  
> **Official Docs:** https://razorpay.com/docs/api/

## Overview
Razorpay provides Orders, UPI/Card/NetBanking Checkout, Subscriptions, Payment Links, Refunds, and Webhook notifications.

## Installation
```bash
npm install razorpay
pip install razorpay
```

## Authentication
Uses HTTP Basic Authentication with `RAZORPAY_KEY_ID` and `RAZORPAY_KEY_SECRET`. Only `key_id` may be passed to frontend Checkout; `RAZORPAY_KEY_SECRET` and `RAZORPAY_WEBHOOK_SECRET` MUST remain strictly server-side.

## Core Concepts
- **Smallest Currency Unit**: `amount` is always an integer in subunits (e.g., `50000` paise = ₹500.00 INR). Never pass floats.
- **Order-First Flow**: Create an Order server-side (`razorpay.orders.create`), pass `order_id` to Checkout, then cryptographically verify `HMAC-SHA256(order_id + "|" + payment_id, key_secret)` server-side before fulfilling the order.
- **Webhook Verification**: Verify the `x-razorpay-signature` header using `validateWebhookSignature(rawBody, signature, webhookSecret)` from `razorpay/dist/utils/razorpay-utils` (or `crypto.createHmac("sha256", secret)` + `crypto.timingSafeEqual`) over the exact raw request body string.

## Error Handling & Rate Limits
- Handle duplicate webhook deliveries idempotently using the `x-razorpay-event-id` header and unique database constraints on `payment_id` / `order_id`.
- Respect HTTP `429` rate limits with exponential backoff.

## Security Best Practices
- Never mark an order paid solely from client-side Checkout success callbacks without server-side signature verification or verified `payment.captured` webhook confirmation.
- Use `crypto.timingSafeEqual` when comparing hex HMAC digests manually.
- Return HTTP `2xx` quickly from webhook handlers (within 5 seconds) to avoid timeout retries.

## AI Pitfalls
- Passing rupees (e.g., `500`) instead of paise (`50000`), charging 100x too little.
- Passing `JSON.stringify(req.body)` instead of the raw request buffer to webhook signature validation.
- Using `RAZORPAY_KEY_SECRET` instead of the separate `RAZORPAY_WEBHOOK_SECRET` for webhook verification.

## Production Checklist
- [ ] Amounts calculated strictly as integer subunits (paise/cents)
- [ ] Payment signature verified server-side with `timingSafeEqual`
- [ ] Webhook endpoint reads raw body and validates `x-razorpay-signature` with `RAZORPAY_WEBHOOK_SECRET`
- [ ] Webhook processing is idempotent on `x-razorpay-event-id`

## References
- [Razorpay API Reference](https://razorpay.com/docs/api/)
- [Razorpay Webhook Validation](https://razorpay.com/docs/webhooks/validate-test/)

## Related skills
- [`stripe`](../stripe/SKILL.md) — alternative to
- [`paddle`](../paddle/SKILL.md) — alternative to
- [`resend`](../resend/SKILL.md) — works well with

Files in this skill

  • SKILL.md2.8 KB
  • examples/quickstart.ts977 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.