Back to BlogGuides & Tutorials

How to Integrate Payment Gateway in India [2026]

Jay PipaliyaPublished July 2, 202618 min read✓ Last Updated: July 2, 2026

Key Takeaways

  • 1Key Takeaways
  • 2Step 1: Choose the Right Payment Gateway
  • 3Step 2: Create Your Account and Complete KYC
  • 4Step 3: Integrate the Payment SDK/API
  • 5Step 4: Handle Webhooks for Reliable Payment Processing

Key Takeaways

  • Razorpay is the most popular payment gateway in India for startups and SMBs — it supports UPI, cards, netbanking, wallets, EMI, and international payments with a 2% transaction fee and no setup cost
  • UPI accounts for 75%+ of digital payments in India in 2026 — any payment integration that does not support UPI is leaving money on the table
  • Integration follows 6 steps: choose gateway → create account and KYC → integrate SDK/API → handle webhooks → test in sandbox → go live — a developer can complete basic integration in 2-5 days
  • Compliance requirements include PCI-DSS (handled by the gateway), GST on transaction fees, RBI data localisation (payment data must be stored in India), and mandatory refund processing within 5-7 business days

Accepting online payments is no longer optional for Indian businesses. With UPI transactions crossing 14 billion per month and digital payment adoption accelerating across Tier-2 and Tier-3 cities, your website or app needs a reliable payment gateway. This guide walks you through choosing the right payment gateway, integrating it into your application, handling edge cases like refunds and failed payments, and staying compliant with RBI regulations — all with specific guidance for the Indian market in 2026.

Step 1: Choose the Right Payment Gateway

India has over 30 payment gateway providers. The right choice depends on your business type, transaction volume, and technical requirements.

GatewayTransaction FeeSetup CostSettlement TimeUPIInternationalBest For
Razorpay2% per transactionFreeT+2 daysYesYesStartups, SaaS, e-commerce
Cashfree1.90% per transactionFreeT+1 to T+2YesYesMarketplaces, payouts
PhonePe (Payment Gateway)0% UPI, 1.99% cardsFreeT+1 to T+3Yes (native)NoUPI-heavy businesses
Paytm for Business1.99% (cards), 0% (UPI under ₹2,000)FreeT+1YesLimitedRetail, small merchants
Stripe India2% domestic, 3% internationalFreeT+2 to T+3Yes (via Stripe)Yes (best)Global SaaS, subscriptions
CCAvenue2-3% (negotiable)₹1,200 setupT+2 to T+5YesYesLarge enterprises, legacy
PayU India2% per transactionFreeT+2YesYesE-commerce, mid-market

Our recommendation: Razorpay for most Indian startups and businesses. It has the best developer experience (comprehensive docs, SDKs for every framework, excellent sandbox), supports all Indian payment methods, and offers additional products like Subscriptions, Payment Links, Payment Pages, and RazorpayX for payouts. For businesses selling globally, add Stripe for international payments — Stripe's subscription billing and multi-currency support is unmatched.

Cashfree is the best alternative to Razorpay, especially for marketplace businesses that need split payments and automated payouts to vendors. Their Payout API can send money to bank accounts, UPI IDs, and wallets in real-time.

PhonePe Payment Gateway offers 0% fees on UPI transactions, making it the most cost-effective option for businesses where UPI is the dominant payment method (restaurants, local services, small-ticket retail).

Step 2: Create Your Account and Complete KYC

Every payment gateway requires business verification before you can accept live payments. Complete this early — KYC approval takes 1-5 business days.

Documents typically required:

  • Business registration: GST certificate, Udyam registration (MSME), or incorporation certificate (for companies)
  • PAN card: Business PAN for companies/firms, individual PAN for sole proprietors
  • Bank account: Current account in the business name (savings account for sole proprietors). The bank account must match the business name on KYC documents.
  • Address proof: Utility bill, rent agreement, or registration certificate showing business address
  • Authorised signatory: Aadhaar and PAN of the person signing up, plus a board resolution or authorisation letter for companies
  • Website or app: A live website/app with visible pricing, refund policy, contact information, and terms of service. Payment gateways review your website for legitimacy — ensure these pages exist before applying.

For Razorpay specifically: Sign up at razorpay.com → Complete the online KYC form → Upload documents → Submit for review → Receive API keys (test keys immediately, live keys after approval). Razorpay often approves within 24-48 hours for straightforward businesses. Complex business models (lending, investment, cryptocurrency) take longer and may require additional documentation.

Important: You can start development immediately using test/sandbox API keys while KYC is being processed. Do not wait for approval to begin integration.

Step 3: Integrate the Payment SDK/API

Payment gateway integration has two parts: the frontend (checkout UI where users enter payment details) and the backend (order creation, payment verification, and webhook handling).

Integration approaches:

  • Drop-in checkout (recommended for most): The payment gateway provides a pre-built, PCI-compliant checkout form that overlays on your page. Users never leave your site. Razorpay Checkout, Cashfree Drop, and Stripe Checkout all follow this pattern. This is the fastest to integrate (1-2 days) and handles all security compliance automatically.
  • Custom UI with APIs: You build the payment form yourself and use the gateway's API to process payments. This gives complete control over the UI but requires PCI-DSS compliance if you handle card data directly. For UPI, you generate a QR code or payment link via API. Recommended only when the checkout experience is a critical differentiator.
  • Payment Links/Pages (no-code): Generate shareable payment links or hosted payment pages without any code. Razorpay Payment Links and Cashfree Payment Links are perfect for service businesses, freelancers, and offline businesses that want to collect payments via WhatsApp or email. Zero integration effort.

Backend integration flow (Razorpay example):

  1. Create an order on your server: Call Razorpay Orders API with the amount, currency (INR), and a unique receipt ID. This returns an order_id.
  2. Open checkout on the frontend: Pass the order_id to Razorpay Checkout JS. The user selects their payment method (UPI, card, netbanking) and completes payment.
  3. Handle payment response: Razorpay returns razorpay_payment_id, razorpay_order_id, and razorpay_signature to your frontend callback.
  4. Verify payment on your server: Send the three values to your backend. Verify the signature using your API secret (HMAC SHA256). This prevents tampering — never trust frontend-only verification.
  5. Update order status: Mark the order as paid in your database. Trigger fulfilment (send confirmation email, update inventory, grant access).

Razorpay provides official SDKs for Node.js, Python, PHP, Java, Ruby, Go, and .NET. For Next.js applications, use the Node.js SDK in API routes and the Razorpay Checkout script on the frontend.

Step 4: Handle Webhooks for Reliable Payment Processing

Webhooks are server-to-server notifications that the payment gateway sends to your application when payment events occur. They are essential for reliable payment processing because frontend callbacks can fail (user closes browser, network drops, redirect fails).

Why webhooks matter:

  • A user can pay successfully but close the browser before the success callback fires — without webhooks, your system never knows the payment succeeded
  • UPI payments can take 30-60 seconds to confirm — the user may navigate away during this time
  • Network issues can prevent your frontend from receiving the payment response
  • Webhooks provide a reliable, server-side confirmation that is independent of the user's browser

Webhook implementation:

  • Create a webhook endpoint: Build an API endpoint on your server (e.g., /api/webhooks/razorpay) that accepts POST requests from the payment gateway
  • Verify webhook signature: Every webhook includes a signature header. Verify it using your webhook secret to ensure the request genuinely came from the payment gateway and was not spoofed
  • Process idempotently: Webhooks can be sent multiple times for the same event (retries). Use the payment_id as an idempotency key — check if you have already processed this payment before updating your database
  • Respond with 200 quickly: Return HTTP 200 within 5 seconds. Do heavy processing (sending emails, updating inventory) asynchronously after responding. If your endpoint is slow, the gateway will retry and you may get duplicate events
  • Handle key events: payment.authorized (payment successful), payment.failed (payment failed), refund.processed (refund completed), subscription.charged (recurring payment collected)

Critical rule: Your webhook handler should be the source of truth for payment status, not the frontend callback. Update order status from webhooks, and use the frontend callback only for user-facing UI updates (showing success/failure screens).

Step 5: Test in Sandbox Environment

Every payment gateway provides a sandbox/test environment with test credentials, test card numbers, and simulated UPI flows. Test exhaustively before going live.

Test scenarios to cover:

  • Successful payment: Test with cards, UPI, netbanking, and wallets. Verify order status updates correctly, confirmation emails are sent, and webhook is processed
  • Failed payment: Use test cards that simulate declines (insufficient funds, expired card, bank refusal). Verify your UI shows appropriate error messages and allows retry
  • Abandoned payment: Start a payment and close the browser mid-flow. Verify your system handles the pending state correctly and does not mark the order as paid
  • Refund flow: Process a test refund and verify the refund webhook updates your database. Ensure the customer sees the refund status in their order history
  • Duplicate payment prevention: Try paying for the same order twice. Your system should either block the second payment or detect the duplicate via webhook
  • Concurrent requests: Simulate multiple users paying simultaneously. Verify no race conditions in order creation or inventory updates
  • Webhook failure recovery: Block your webhook endpoint temporarily and then unblock it. The gateway should retry and your system should process correctly after recovery

Razorpay test credentials: Use test key (rzp_test_xxxxx), test card number 4111 1111 1111 1111, test UPI ID success@razorpay, and test netbanking flow. All available in Razorpay Dashboard → Settings → API Keys.

Step 6: Go Live and Monitor

After thorough testing, switch from sandbox to production credentials and start accepting real payments.

Go-live checklist:

  • Switch API keys: Replace test API keys with live keys in your environment variables. Never hardcode keys in source code — use environment variables or a secrets manager
  • Verify webhook URL: Update the webhook URL in the gateway dashboard to point to your production endpoint. Test by making a small real payment (₹1-10) and verifying the full flow
  • SSL certificate: Your website must use HTTPS. Payment gateways will reject requests from non-HTTPS origins
  • Error monitoring: Set up alerts for payment failures, webhook processing errors, and settlement discrepancies. Integrate with Sentry or similar error tracking
  • Reconciliation: Download daily settlement reports from the gateway dashboard and reconcile against your database. Automate this with the Reports API for high-volume businesses
  • Refund policy: Display a clear refund policy on your website. RBI mandates that refunds for failed transactions must be initiated within T+5 days. Process customer-initiated refunds within your stated policy timeframe

Ongoing monitoring: Track payment success rate (should be 95%+ for cards, 98%+ for UPI), average settlement time, refund turnaround time, and customer complaints about payments. A drop in success rate often indicates a technical issue (broken webhook, expired SSL, API version change) that needs immediate attention.

UPI Integration Deep Dive

UPI (Unified Payments Interface) is the dominant payment method in India, processing 14+ billion transactions per month. In 2026, UPI accounts for 75%+ of all digital payments. If you are building for the Indian market, UPI integration is not optional — it is primary.

UPI payment flows:

  • UPI Intent (mobile apps): Your app triggers the user's UPI app (Google Pay, PhonePe, Paytm) to complete payment. Fastest flow with highest success rate. Works only on mobile devices.
  • UPI Collect: User enters their UPI ID (name@upi), and a payment request is sent to their UPI app for approval. Works on both mobile and desktop. Slightly lower success rate due to the extra step of entering the UPI ID.
  • QR Code: Generate a dynamic QR code that the user scans with any UPI app. Popular for in-store payments and desktop web payments. The user scans and approves — no typing required.
  • UPI Autopay (mandates): For recurring payments (SaaS subscriptions), UPI Autopay lets users set up automatic debits. RBI mandates require explicit user consent for each mandate and provide a 24-hour pre-debit notification. Razorpay and Cashfree support UPI Autopay through their Subscriptions API.

UPI-specific considerations:

  • UPI transactions under ₹2,000 have zero merchant discount rate (MDR) — effectively free for merchants
  • UPI payment confirmation can take 5-60 seconds (asynchronous). Show a "payment processing" screen and rely on webhooks for confirmation
  • UPI success rates vary by time of day — they drop during peak hours (salary days, festivals) when NPCI infrastructure is under load
  • Always provide a "check payment status" button for users who are unsure if their payment went through

GST and Compliance Considerations

Payment processing in India involves several compliance requirements that affect your integration.

  • GST on payment gateway fees: The 2% transaction fee charged by payment gateways is subject to 18% GST. So the effective cost is 2.36% per transaction. This GST is input-creditable if your business is GST-registered.
  • RBI data localisation: Since 2019, the RBI mandates that all payment data related to Indian transactions must be stored on servers located in India. Major payment gateways (Razorpay, Cashfree, PayU) comply with this automatically. If you are building custom payment processing, ensure your payment database is hosted in India (AWS Mumbai, GCP Mumbai).
  • PCI-DSS compliance: If you use drop-in checkout (Razorpay Checkout, Stripe Checkout), the payment gateway handles PCI compliance. You never touch card data, and your SAQ (Self-Assessment Questionnaire) level is minimal. If you build custom card input forms, you must comply with PCI-DSS Level 1 — expensive and complex. Use drop-in checkout unless you have a very specific reason not to.
  • Refund regulations: RBI mandates that refunds for failed transactions must be credited back within T+5 business days. Customer-initiated refunds should follow your published refund policy. Razorpay and Cashfree handle the actual refund processing — you just initiate it via API.
  • Invoice generation: For B2B transactions, you must generate GST-compliant invoices. Razorpay provides automated invoice generation via their Invoice API. For custom invoicing, ensure you include GSTIN, HSN/SAC code, tax breakup (CGST/SGST/IGST), and invoice number series.

Cost and Timeline Summary

Integration TypeDevelopment TimeCostOngoing Fee
Payment Links (no code)1 hour₹02% per transaction
Drop-in Checkout (basic)2-3 days₹10,000-30,000 (developer time)2% per transaction
Full integration with webhooks5-7 days₹30,000-60,0002% per transaction
Subscriptions + recurring billing1-2 weeks₹50,000-1.5 lakh2% + subscription fees
Marketplace (split payments)2-3 weeks₹1-3 lakh2% + payout fees
Multi-gateway with fallback2-4 weeks₹1.5-4 lakhVaries by gateway

When to DIY vs Hire a Professional

DIY integration works when:

  • You are using drop-in checkout with a single gateway (Razorpay/Cashfree)
  • Your developer has experience with REST APIs and webhook handling
  • You have simple one-time payment requirements (no subscriptions, no split payments)
  • You can dedicate 3-5 days of development time to do it properly

Hire a professional when:

  • You need subscription billing with plan management, upgrades/downgrades, and proration
  • You are building a marketplace with split payments to multiple vendors
  • You need multi-gateway integration with intelligent routing and fallback
  • Payment processing involves complex business logic (escrow, milestone payments, conditional releases)
  • You must integrate with Tally, Zoho Books, or custom accounting software for automated reconciliation

JK Tech Hub has integrated payment gateways for 80+ applications — from simple e-commerce checkout to complex marketplace payment flows with split settlements. We work with Razorpay, Cashfree, Stripe, and PhonePe APIs. Get a free consultation for your payment integration needs.

Sources & References

Need help integrating a payment gateway? Contact JK Tech Hub for expert payment integration. We handle Razorpay, Cashfree, Stripe, and custom payment flows — 150+ projects delivered, 4.9/5 client rating, based in Rajkot, Gujarat. Get an instant estimate.

Tags

payment gateway integration indiaRazorpay integration guideUPI integrationPhonePe API guidepayment API indiaonline payment setupStripe india

Need Help with Guides & Tutorials?

Our team at JK Tech Hub is ready to help you build the right solution for your business. Let's discuss your project.

Contact Us