What is Razorpay for Magento ?
Razorpay for Magento is the official razorpay/magento payment module that plugs India’s largest payment gateway into Magento 2 — UPI (Google Pay / PhonePe / Paytm UPI / BHIM), Indian cards (Visa / Mastercard / RuPay), wallets, netbanking (50+ banks), EMI (cards + cardless), and Magic Checkout (single-tap COD-to-prepaid). Razorpay is an RBI-licensed Payment Service Provider, the mandatory layer for any D2C / B2C store selling to Indian customers. Standard MDR ~2% (UPI 0% until regulated), with RBI-mandated tokenisation built in.
Five steps from composer install to live UPI checkout
The official razorpay/magento module ships every Indian payment rail out of the box. Here is the wiring, end to end.
-
01
Composer-install the official Razorpay module
Run
composer require razorpay/magentofrom the Magento project root. The package is published under the MIT licence on Packagist by Razorpay Software Pvt Ltd and is the only payment module officially endorsed by Razorpay for Magento 2.x. Avoid the third-party clones on GitHub — they lag the official module by 6 – 12 months on RBI compliance patches and routinely break on Magento minor upgrades. -
02
Register and clear caches
Run
bin/magento setup:upgrade --keep-generatedto register the module, thenbin/magento cache:flushto drop the config / layout / block_html caches. On a production deploy addsetup:di:compileandsetup:static-content:deployas part of the normal deployer flow — Razorpay’s admin UI components are compiled assets and need fresh static content to render. -
03
Paste API keys from the Razorpay dashboard
Sign in at
dashboard.razorpay.com→ Settings → API Keys, generate a Key ID + Key Secret pair (test mode first, switch to live once KYC is approved). In Magento admin go to Stores → Configuration → Sales → Payment Methods → Razorpay, paste both keys, set Payment Action toAuthorize and Capture, and enable the method. Use config-scope-specific keys if you run multiple Indian websites — Razorpay supports one merchant per website. -
04
Customer pays via UPI, card, EMI, wallet, or netbanking
At the Magento checkout the Razorpay popup widget loads (or embedded inline for Hyvä themes via the 5.x module). The customer picks a method: UPI (Google Pay / PhonePe / Paytm UPI / BHIM intent), Indian cards (Visa / Mastercard / RuPay / Amex), EMI (cards + cardless from Bajaj / ZestMoney / EarlySalary), wallets (Paytm / Mobikwik / Freecharge / Amazon Pay), or netbanking (50+ Indian banks). Razorpay tokenises the card per RBI rules and authorises the payment in < 3 seconds.
-
05
Webhooks fire on capture, failure, and refund
Razorpay POSTs server-to-server webhooks to
https://your-store.com/razorpay/webhookonpayment.captured,payment.failed,order.paid, andrefund.processed. The Magento module verifies the HMAC-SHA256 signature against the webhook secret you set in the Razorpay dashboard, then writes the order state transition (pending → processing → complete). Always enable webhook signing — without it any actor can replay a payment.captured event and mark unpaid orders as paid.
Four scenarios where Razorpay is the obvious answer
If your Magento store touches Indian payment flows, Razorpay is rarely optional. These four scenarios are unambiguous wins.
-
D2C / B2C stores selling to Indian customers
If your storefront accepts INR and ships to India, Razorpay is effectively mandatory. UPI alone now drives more than 50% of D2C checkout volume in India — a store without UPI loses roughly half its conversions before the customer even reaches the payment screen. Stripe, PayPal, and Adyen don’t process UPI natively. Razorpay does, with sub-3-second authorisation and a fee structure (0% MDR on UPI till the RBI changes the rule) that no foreign PSP matches.
-
Cross-border stores accepting INR
A US or EU storefront billing Indian customers in INR needs a domestic payment rail to bypass the 3 – 5% foreign-card surcharge most Indian banks add on cross-border MasterCard / Visa transactions. Razorpay accepts INR locally (no FX markup at checkout), handles AEPS / forex / IRCTC integrations for Indian buyers, and settles to your INR Razorpay current account — from which Razorpay X can wire to your USD / EUR account at near-mid-market rates.
-
B2B Magento with Indian Net-30 invoicing
B2B Magento stores doing Net-30 / Net-60 invoicing to Indian distributors need RazorpayX for B2B payouts (vendor disbursements, salary, refunds) and optionally Razorpay Capital for invoice financing — lend against unpaid invoices at 11 – 16% APR. Combined with the Magento module, this gives you collection (cards + UPI + netbanking), payout (RazorpayX), and working-capital (Razorpay Capital) on a single dashboard.
-
Subscriptions and recurring auto-debit in India
The RBI 2021 recurring-mandate rules killed simple card-on-file recurring debits in India. Razorpay Subscriptions ships an eMandate workflow (UPI AutoPay + card-based recurring under the new RBI framework) that Magento subscription modules (Aheadworks, Mageworx, Amasty) can wire into. If you sell SaaS, dairy / grocery boxes, gym memberships, or any auto-renew product to Indian customers, Razorpay Subscriptions is the only PSP-side integration that survives RBI scrutiny.
Three Razorpay misconfigs that wreck a Magento store
Every Razorpay-related Magento outage I've been called in to debug came from one of these three mistakes. Audit your config and dashboard for them today.
-
Storing raw card data in Magento
Under the RBI 2022 tokenisation mandate it is illegal for any Indian merchant or PSP to store raw card numbers, expiry dates, or CVVs — only the card-issuer and the card-network may. Every recurring / saved-card flow must use a Razorpay vault token (a network-scope token returned by Razorpay’s tokenise API). Never persist
card.number,card.cvv, orcard.expiryinto the Magento DB, log files, or third-party tools — the RBI fines for non-compliance start at INR 1 crore per breach. -
Skipping the Magic Checkout upgrade
India’s Cash-on-Delivery (COD) order rate sits at 60 – 70% by default — and COD orders have a Return-to-Origin (RTO) rate of 25 – 35%, which destroys margins after reverse logistics. Razorpay Magic Checkout is a single-tap UPI / card prompt that converts roughly 30% of would-be COD orders into prepaid orders at checkout. Skipping the Magic Checkout integration costs typical D2C stores ~12% revenue from RTO losses alone. The Magento module supports Magic Checkout out of the box — just enable it in admin config.
-
Leaving webhook signing disabled
By default Razorpay webhooks are unsigned — any client that can POST to your
/razorpay/webhookendpoint can fake apayment.capturedevent and mark unpaid orders as paid. In the Razorpay dashboard → Settings → Webhooks, set a strong webhook secret, then in Magento admin paste the same secret into the Razorpay payment-method config. The module verifies the HMAC-SHA256 signature on every incoming webhook and rejects unsigned or mismatched calls.
Razorpay for Magento — frequently asked questions
-
Razorpay vs Stripe for India — which one wins?
Razorpay, every time, if your customer is paying from India. Stripe does not process UPI natively, charges 4.3% + INR 3 on international cards (vs Razorpay's ~2% domestic), and routes through a foreign acquiring bank that triggers RBI cross-border-payment FX checks on every charge. Razorpay holds an RBI Payment Aggregator licence, processes UPI at 0% MDR (until the RBI changes the rule), and settles directly to your INR current account in T+1 days. Use Stripe for non-Indian markets, Razorpay for India. Many Magento stores wire both modules side by side and route by billing country. -
What is UPI and why does my store need it?
UPI (Unified Payments Interface) is India's real-time inter-bank instant-payment rail, launched by NPCI in 2016 and now processing more than 11 billion transactions per month (2024 NPCI data). Roughly 60% of Indian D2C checkout volume is now UPI — customers tap a Google Pay / PhonePe / Paytm UPI / BHIM intent at checkout, approve the debit on their phone, and the funds land in your account in under 5 seconds. A Magento store without UPI loses roughly half its Indian conversions before the payment screen even loads. Razorpay's Magento module supports UPI intent (mobile) and UPI collect (desktop QR-code) out of the box. -
How does RBI tokenisation work?
Under the RBI 2022 mandate, no merchant, payment aggregator, or gateway may store raw card data (PAN, expiry, CVV) — only the card-issuer and the card-network. For saved cards, Razorpay calls Visa / Mastercard / RuPay's network tokenisation APIs and stores a network-scope token (a 16-digit reference unique to your merchant + that card) in place of the real PAN. When the customer pays again, Razorpay sends the token + cryptogram to the issuer, which detokenises and authorises. From your Magento side, you store only the token reference and the last-4 digits — no raw card data ever lands in your DB or logs. The module handles all of this transparently. -
Razorpay Magic Checkout — is it worth the integration cost?
Yes, for any D2C / B2C store with more than 100 orders a month. Magic Checkout is a one-tap UPI / card / wallet prompt that converts roughly 30% of would-be COD (cash-on-delivery) orders into prepaid orders. Indian COD orders have a Return-to-Origin (RTO) rate of 25 — 35%, costing INR 80 — 150 per failed delivery in reverse logistics; prepaid orders RTO at under 5%. On a 1,000-order-per-month store with 65% COD, Magic Checkout saves roughly INR 50,000 — 80,000 per month in RTO losses alone. The Razorpay Magento module enables Magic Checkout via a single admin toggle once Magic is provisioned on your Razorpay dashboard. -
Does Razorpay work with Hyvä themes?
Yes. The official razorpay/magento module version 5.x added native Hyvä Themes compatibility — the popup widget is replaced with an inline Alpine.js + Tailwind component that renders on the Hyvä checkout without pulling in Knockout JS or RequireJS. If you are on an older 4.x module, upgrade with composer require razorpay/magento:^5.0 then run setup:upgrade. The Hyvä compatibility module by Hyvä-Themes/magento2-razorpay is also available as a fallback for stores that cannot upgrade past 4.x. Either way, Razorpay is one of the better-supported payment methods in the Hyvä ecosystem. -
What is Razorpay Affordability / EMI / Pay-Later?
Razorpay Affordability bundles three credit-on-checkout products. EMI on cards: customer pays via a Visa / Mastercard / RuPay credit card and converts the transaction to a 3 / 6 / 9 / 12-month EMI at the card-issuer's rate (~13 — 18% APR). Cardless EMI: no card required — Razorpay underwrites the customer through Bajaj Finserv / ZestMoney / EarlySalary / IDFC First Bank and grants a 3 — 12 month EMI at ~14 — 18% APR. Pay-Later: 0% interest 30-day deferred payment via Simpl / LazyPay / Mobikwik ZIP. All three appear at the Razorpay checkout when the cart value exceeds the minimum threshold (typically INR 3,000+) and are enabled with one admin-config toggle on the Magento module.
Want a Razorpay audit on your Magento store?
Send your storefront URL — I will run a Razorpay integration audit (module version, webhook signing, tokenisation, Magic Checkout, Hyvä compatibility) and reply with a written tuning plan, fixed-price quote, and earliest start date. 24-business-hour turnaround.