Razorpay — Overview
What Razorpay is, how payments flow through it, and why it is the right choice for Indian applications.
Every application that takes money needs a payment gateway. Building one yourself — handling card data, banking integrations, UPI rails, PCI compliance — would take years and cost crores. Razorpay handles all of that and charges 2% per transaction.
This section walks you through setting up Razorpay, understanding Test Mode, securing your API keys, and wiring up the full payment flow that EduTrack uses.
The "Why First" Scenario
Your school management app is working. A parent selects the fee they need to pay and reaches the checkout screen.
Now what?
If you collect cash at the school office, you have no upfront commitment — parents delay, the admin team makes repeated follow-up calls. You need the parent to pay online at the time of fee submission.
You could build payment processing yourself:
- Apply to each bank individually for a merchant account
- Handle raw card data (triggers PCI DSS compliance — a 300-point security audit)
- Integrate with UPI rails separately (NPCI certification required)
- Build fraud detection
- Handle refunds, chargebacks, disputes
- Integrate net banking for 50+ Indian banks
That is a multi-year project requiring a dedicated payments team.
Razorpay handles every bit of that. You spend two days setting it up. They take 2% per transaction. Every rupee of that 2% buys you:
- UPI (GPay, PhonePe, Paytm, BHIM, BHIM UPI)
- Credit and debit cards (Visa, Mastercard, Rupay, Amex)
- Net banking (all major Indian banks)
- EMI (no-cost EMI, bank EMI, cardless EMI)
- Digital wallets (Paytm Wallet, Amazon Pay, FreeCharge)
- International cards (with FEMA compliance handled)
- Fraud detection and PCI DSS compliance
- Dispute management and chargeback handling
The economic logic is simple: 2% is what you pay to not build a fintech company.
The CA Analogy
You already understand this model from your accounting work.
Think of Razorpay exactly like the payment gateway your CA firm's billing software uses when a client pays online. Money flows from the client's account → through the gateway → to the firm's bank account. The gateway takes a small cut for the service. The firm gets the rest, net of the commission, in a settlement cycle.
Razorpay is that gateway for your application. The settlement cycle is T+3 business days — just like a card payment at a physical store. The commission is 2% + GST on the 2%.
| Concept | CA World | Razorpay |
|---|---|---|
| Payment gateway | Bank's POS/payment link service | Razorpay |
| Commission | Merchant Discount Rate (MDR) | 2% per transaction |
| Settlement | T+1 or T+3 depending on bank | T+3 business days |
| GST on commission | 18% GST on MDR | 18% GST on Razorpay's 2% fee |
| Reconciliation | Bank statement vs billing records | Razorpay dashboard vs your database |
GST note for CAs: The 2% Razorpay commission is a taxable service. Razorpay charges 18% GST on top of it, making the effective cost 2.36% per transaction (2% + 0.36% GST). This GST is recoverable as Input Tax Credit if your business is GST-registered. For a ₹1,000 transaction: Razorpay deducts ₹23.60 (₹20 fee + ₹3.60 GST). You receive ₹976.40.
Payment Methods Razorpay Supports
| Method | Examples | Who uses it |
|---|---|---|
| UPI | GPay, PhonePe, Paytm, BHIM | Most Indian users under 40 |
| Credit cards | Visa, Mastercard, Amex, Rupay | Urban professionals |
| Debit cards | All bank-issued debit cards | Broad base |
| Net banking | SBI, HDFC, ICICI, Axis, 50+ more | Users who prefer bank login |
| EMI | No-cost EMI, bank EMI, cardless EMI | Larger purchase amounts |
| Wallets | Paytm, Amazon Pay, FreeCharge | Users with wallet balance |
| International | Visa/Mastercard, PayPal | NRIs and foreign clients |
For EduTrack's customer base (urban, 25–45 age group), UPI will be 60–70% of all transactions based on Indian market data. Razorpay's UPI support is critical.
How Razorpay Fits in the Architecture
Notice what the React app (frontend) never touches: the Key Secret. The Key Secret is used only inside Edge Functions — server-side code that runs in Supabase's secure environment. The customer's browser has no access to it.
Never call the Razorpay API directly from the React app. The Razorpay SDK's checkout.js that runs in the browser is only for displaying the payment modal. All order creation and payment verification happens server-side in Supabase Edge Functions. This is the architecture in the CLAUDE.md global rules — the reason is that the Key Secret must never be exposed to the browser.
Razorpay's Pricing (What the Client Pays For)
Understanding the cost structure matters when you are presenting this to a client:
| Transaction type | Fee |
|---|---|
| Domestic cards, UPI, net banking, wallets | 2% + 18% GST on fee |
| International cards | 3% + 18% GST on fee |
| EMI | 1.5%–3% depending on bank and tenure |
No monthly fees. No setup fees. No minimum transaction volume. You only pay when you make money. This is the right model for early-stage products.
Settlement: Razorpay settles to your bank account every business day for transactions that are T+3 days old. If a customer pays on Monday, the money reaches your bank account on Thursday (assuming no weekends or bank holidays in between).
The Paise Trap — Read This Now
Every amount in Razorpay's API is specified in paise, not rupees.
₹1 = 100 paise
| Rupees | Paise (what you pass to Razorpay) |
|---|---|
| ₹1 | 100 |
| ₹299 | 29900 |
| ₹1,499 | 149900 |
| ₹10,000 | 1000000 |
This is consistent with how payment APIs work globally (Stripe uses cents, Razorpay uses paise). The reason is that floating-point arithmetic in computers is unreliable for money — integers are exact. 29900 is always exactly ₹299. 299.00 as a float can introduce rounding errors.
This is the most common Razorpay bug. Passing 299 instead of 29900 charges the customer ₹2.99 instead of ₹299. Always multiply by 100 before passing any amount to Razorpay. Build a helper function once and use it everywhere:
What You Will Have After This Section
| Step | What you'll set up | Page |
|---|---|---|
| 1 | Razorpay account created | Account Setup |
| 2 | Test Mode understood | Test vs Live |
| 3 | API keys generated and saved | API Keys |
| 4 | Full payment flow working | Payment Flow |
| 5 | Webhooks configured | Webhook Setup |
| 6 | End-to-end test payment verified | Verification |
Time Required
| Page | Estimated time |
|---|---|
| Overview (this page) | 10 minutes reading |
| Account Setup | 15 minutes |
| Test vs Live | 10 minutes reading |
| API Keys | 10 minutes |
| Payment Flow | 45 minutes (reading + implementation) |
| Webhook Setup | 20 minutes |
| Verification | 15 minutes |
Total: approximately 2 hours for first-time setup. After the first project, setup takes 20 minutes.