CommunityProgramación y desarrollogithub.com

razorpay-payments

Integrates Razorpay payments into any backend or app (Next.js, Node.js, Express, Python, PHP, Laravel, Java, Go, Ruby, Rust, .NET, Android, iOS, React Native or Flutter) with server-side orders, Standard Checkout, signature verification, webhooks, capture, refunds, Subscriptions, Payment Links, UPI QR codes, saved cards, Smart Collect, Route splits, RazorpayX payouts and settlement reconciliation. Use when the user mentions Razorpay, rzp_test or rzp_live keys, razorpay_signature or X-Razorpay-Signature. Use it when a web app needs to accept INR, UPI or card payments in India. Use it to review or debug a Razorpay integration, for example a webhook that fails signature checks, payments that are refunded on their own or paid orders that stay unpaid. Also use it to set up the official Razorpay MCP server safely.

¿Qué es razorpay-payments?

razorpay-payments is a Claude Code agent skill that integrates Razorpay payments into any backend or app (Next.js, Node.js, Express, Python, PHP, Laravel, Java, Go, Ruby, Rust, .NET, Android, iOS, React Native or Flutter) with server-side orders, Standard Checkout, signature verification, webhooks, capture, refunds, Subscriptions, Payment Links, UPI QR codes, saved cards, Smart Collect, Route splits, RazorpayX payouts and settlement reconciliation. Use when the user mentions Razorpay, rzp_test or rzp_live keys, razorpay_signature or X-Razorpay-Signature. Use it when a web app needs to accept INR, UPI or card payments in India. Use it to review or debug a Razorpay integration, for example a webhook that fails signature checks, payments that are refunded on their own or paid orders that stay unpaid. Also use it to set up the official Razorpay MCP server safely.

Compatible con~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/AntoJebi7/razorpay-skill/tree/HEAD/skills/razorpay-payments

Installed? Explore more Programación y desarrollo skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Razorpay payments

Community guide, checked against Razorpay's docs and official SDKs. When something here disagrees with https://razorpay.com/docs, the docs win.

The flow (never skip a step)

  1. Server creates an order. The amount comes from your database or price list, never from the browser. Amounts are integers in the smallest unit: ₹299 is 29900 paise.
  2. Browser opens Checkout with the public key_id and the order_id. Never send key_secret to the browser.
  3. Server verifies the signature, then confirms the capture. The signature proves the response came from Razorpay; it does not prove the money is captured. Fetch the payment and mark the order paid only if it is captured for that order and amount. If it is only authorized, show "processing".
  4. Webhook confirms the payment (order.paid or payment.captured). Mark the order paid on whichever of steps 3 or 4 arrives first, with a conditional update, so the second one does nothing.

Payments made without an order_id cannot be captured and are refunded automatically. Always create an order first. Subscriptions, Payment Links and mobile apps follow the same shape.

Before writing code

Find the stack in use (package.json, requirements.txt, composer.json, pom.xml, go.mod, Gemfile, .csproj, Cargo.toml, pubspec.yaml), check what already exists, then read only the reference you need:

TaskRead
Next.js App Router setup (files to create)references/nextjs-app-router.md
Express, Python, PHP, Java, Go, Ruby, .NET or Rustreferences/stacks.md
Orders, Checkout options, payment statesreferences/orders-and-checkout.md
Signature checks and webhooksreferences/verification-and-webhooks.md
Capture settings and refundsreferences/capture-and-refunds.md
Recurring billingreferences/subscriptions.md
Invoices or payment requests without a checkout pagereferences/payment-links.md
UPI QR codes (counter or per order)references/qr-codes.md
Saved cards (tokens) or bank transfers to a customer identifierreferences/saved-cards-and-smart-collect.md
Marketplace splits to sellers (Route)references/route.md
Sending money out: vendors, salaries, cashback (RazorpayX)references/payouts.md
Android, iOS, React Native or Flutter appsreferences/mobile-apps.md
Settlements, fees and daily reconciliationreferences/settlements-and-reconciliation.md
API errors, retries, late payments, missed webhooks, disputesreferences/errors-and-recovery.md
Connecting the official Razorpay MCP serverreferences/mcp-server.md
Test mode, local webhooks, go-live checklistreferences/testing-and-go-live.md
Reviewing an existing integrationThe review checklist below

Environment variables

RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxxxx        # public, also exposed to the browser
RAZORPAY_KEY_SECRET=xxxxxxxxxxxxxxxxxxxxxxxx   # server only
RAZORPAY_WEBHOOK_SECRET=xxxxxxxxxxxxxxxx       # server only, set when creating the webhook
NEXT_PUBLIC_RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxxxx  # Next.js only
  • rzp_test_ keys are test mode and rzp_live_ keys take real money. Use one mode end to end: create the order and open Checkout with keys from the same mode.
  • The webhook secret is a separate value you choose in the Dashboard. It is not the key secret.
  • Never commit real keys. Keep them in env files that git ignores and in the hosting provider's env settings.

Rules

  1. Amounts in paise, as integers. Convert rupees to paise once, on the server, rounding to an integer. Never multiply twice.
  2. Set the price on the server. Look up the price from the product or plan id the client sends. Ignore any amount the client sends.
  3. Verify the Checkout signature on the server, then require a captured payment: HMAC SHA256 of order_id + "|" + razorpay_payment_id with key_secret, using the order_id you stored, not the one the browser sends back. A failed check means reject. A passed check is not enough to deliver: fetch the payment and require status: "captured", a matching order_id and amount.
  4. Verify webhooks against the raw body. Read the body as raw text before any JSON parsing and HMAC it with the webhook secret. Never verify re-serialised JSON: it changes the bytes and the check fails. references/stacks.md shows how to get the raw body in each framework.
  5. Compare signatures in constant time (for example crypto.timingSafeEqual after checking lengths). The Node and .NET SDK helpers use plain equality.
  6. Webhooks arrive at least once and out of order. Record the x-razorpay-event-id in the same database transaction as the event's effects, so a crash rolls both back and the retry runs again. Every status change is conditional on the current state: only created or failed can become paid. A refunded order never becomes paid again.
  7. Return 2xx fast. Any non-2xx response counts as a failure. Razorpay retries with backoff for 24 hours, then disables the webhook. Queue slow work (emails, access) in the same transaction as an outbox job and run it in a worker.
  8. Capture every payment. Authorized payments that are never captured are refunded automatically (default timeout 3 days). Turn on auto-capture in the Dashboard or capture through the API.
  9. Keep the secret server side. Only key_id and order_id go to the browser. Code that uses key_secret must never ship in a client bundle.
  10. Store every id. Save order_id, payment_id, status and amount in your database so you can reconcile, refund and answer support questions.
  11. Confirm before moving money. Before running anything that captures, refunds, creates a payout, transfers or reverses funds, requests an instant settlement, cancels a subscription, accepts or contests a dispute or sends a payment request on a real account (through code, a script or the MCP server), show the user the action, the mode, the ids and the amount in rupees, then wait for an explicit yes.
  12. Investigate before retrying. After a timeout or a 5xx, fetch the order, payment or refund first and act only on what is missing. A payment.failed is not always final: banks can authorize a payment up to 3 days later.
  13. Protect the endpoints. Order and verify routes need the signed in user (an order belongs to one user), input validation and rate limiting. The samples in this skill show the payment logic; wire them into your own auth, database and queue before production.

Review checklist (existing integrations)

Flag each item that fails, with file and line:

  • Order created on the server with an amount the server computed
  • Amount is an integer in paise; no float maths and no double conversion
  • key_secret and RAZORPAY_WEBHOOK_SECRET never reach client code or logs
  • Checkout signature verified on the server, using the stored order_id
  • Order marked paid only after the payment is fetched and found captured for that order and amount
  • Webhook verified against the raw body with the webhook secret, in constant time
  • Event id stored in the same transaction as the event's effects; a processing error returns 5xx
  • Status updates are conditional (WHERE status IN (...)); a refunded order cannot become paid
  • Order and verify routes check the signed in user, validate input and are rate limited
  • Fulfilment runs once, whether the verify call, the webhook or a reconciliation job gets there first
  • Webhook returns 2xx quickly and does not depend on event order
  • Capture is automatic or the code captures within the timeout
  • Test and live keys come from env vars, not code
  • Payment failures are shown to the user with a retry option; a failed payment does not close the order for good
  • Refund and capture actions cannot run twice from a double click or a retry
  • A daily job reconciles settled payments against the database and flags gaps
  • Payouts send a stored X-Payout-Idempotency key and reuse it on retries
  • Mobile apps hold only key_id; the server verifies every payment

Beyond this skill

For products not described here (for example Magic Checkout, Optimizer or POS), follow https://razorpay.com/docs directly. The signature, webhook and confirm rules above still apply.

Skills relacionados