BUNTYTECH
Web Development

UPI Payment Integration for Websites: Razorpay, PayU, and Cashfree Guide 2025

Bunty Arora Jun 10, 2025 16 min read 390 views
UPI Payment Integration for Websites: Razorpay, PayU, and Cashfree Guide 2025

UPI Payment Integration for Indian Websites: Complete 2025 Guide

India is the world's leader in digital payments. India processes over 10 billion UPI transactions per month — more than any other country's payment system. If your website doesn't accept UPI, you're turning away the majority of Indian digital payment users.

This guide covers everything you need to integrate Indian payment gateways into your website, from technical setup to choosing between Razorpay, PayU, and Cashfree.

Indian Payment Methods: What You Must Support

For maximum conversion in the Indian market, your website must accept:

Payment Gateway Comparison: Razorpay vs PayU vs Cashfree

Razorpay

Market position: India's most popular payment gateway for startups and SMEs

Transaction fees:

Key features:

Documentation quality: Excellent. Best-in-class API documentation in India. Multiple SDK options (JavaScript, PHP, Python, Node.js, Java).

Settlement time: T+3 days (next working day available for fee)

Best for: Startups, ecommerce, web apps, subscriptions

PayU

Market position: One of India's oldest payment gateways, trusted by large enterprises

Transaction fees:

Key features:

Best for: Established businesses, high-volume transactions, those needing buy-now-pay-later options

Cashfree Payments

Market position: Growing rapidly with focus on developer experience and fast settlements

Transaction fees:

Key features:

Best for: Businesses where settlement speed is critical, marketplaces, B2B payments

Summary: Which to Choose?

Integrating Razorpay: Technical Implementation

Here's how to integrate Razorpay into a PHP-based website:

Step 1: Create Razorpay Account

  1. Sign up at razorpay.com
  2. Complete KYC verification (PAN, bank account, business documents)
  3. Go to Settings → API Keys
  4. Generate Test Mode API keys (Key ID and Key Secret)

Step 2: Add Razorpay Checkout Script

Add to your HTML:

<script src="https://checkout.razorpay.com/v1/checkout.js"></script>

Step 3: Create Order via Backend (PHP example)

<?php
// Install Razorpay PHP SDK: composer require razorpay/razorpay
require "vendor/autoload.php";
use RazorpayApiApi;

$api = new Api("YOUR_KEY_ID", "YOUR_KEY_SECRET");
$order = $api->order->create([
    "amount" => 50000, // Amount in paise (₹500 = 50000 paise)
    "currency" => "INR",
    "receipt" => "order_" . time(),
    "payment_capture" => 1
]);
$orderId = $order["id"];
?>

Step 4: Frontend Checkout JavaScript

var options = {
    "key": "YOUR_KEY_ID",
    "amount": "50000",
    "currency": "INR",
    "name": "Your Business Name",
    "description": "Service Description",
    "image": "https://yourdomain.com/logo.png",
    "order_id": "<?php echo $orderId; ?>",
    "handler": function (response) {
        // Verify payment on server
        document.getElementById("payment_id").value = response.razorpay_payment_id;
        document.getElementById("payment_form").submit();
    },
    "prefill": {
        "name": "Customer Name",
        "email": "customer@email.com",
        "contact": "9XXXXXXXXX"
    },
    "theme": { "color": "#404E3B" }
};
var rzp = new Razorpay(options);
rzp.open();

Step 5: Verify Payment on Server

<?php
$paymentId = $_POST["razorpay_payment_id"];
$orderId = $_POST["razorpay_order_id"];
$signature = $_POST["razorpay_signature"];

$api = new Api("YOUR_KEY_ID", "YOUR_KEY_SECRET");
try {
    $attributes = [
        "razorpay_order_id" => $orderId,
        "razorpay_payment_id" => $paymentId,
        "razorpay_signature" => $signature
    ];
    $api->utility->verifyPaymentSignature($attributes);
    // Payment is verified - update database, send confirmation email
    echo "Payment Successful!";
} catch(Exception $e) {
    echo "Payment Verification Failed";
}
?>

UPI Deep Linking

For mobile apps or WhatsApp checkout flows, you can open the UPI app directly:

// UPI payment intent (works across all UPI apps)
upi://pay?pa=yourvpa@ybl&pn=YourName&am=500&cu=INR&tn=ServiceDescription

This opens the user's default UPI app with payment pre-filled. Better UX than a payment gateway for simple one-time payments.

Handling Refunds

All major gateways provide refund API:

GST on Payment Gateway Fees

Payment gateway fees attract 18% GST. This GST is claimable as input tax credit if your business is GST registered. Factor this into your pricing.

Example: Razorpay charges 2% on ₹1,000 = ₹20. GST on ₹20 = ₹3.60. Total deducted = ₹23.60. You receive ₹976.40.

Security Best Practices

Conclusion

Integrating Indian payment gateways is essential for any ecommerce or service business website. Start with Razorpay for the best developer experience, then consider alternatives as your volume grows and you need to negotiate better rates.

Need help integrating Razorpay, PayU, or Cashfree into your website? Contact me — I have extensive experience integrating Indian payment gateways for clients across India.

Tags: Razorpay integration India UPI payment website PayU integration Indian payment gateway
Tweet Share WhatsApp

Need a Website or SEO Services in Haryana & Punjab?

Hire Bunty Arora — Best Full Stack Developer. Call: +91-97296-21995

Get Free Quote
Back to Blog

MORE ARTICLES

Best Website Developer in Haryana - Why Local Expertise Matters
SEO8 min

Best Website Developer in Haryana - Why Local Expertise Matters

Read More
Best Website Developer in Punjab - Serving All Major Cities
SEO10 min

Best Website Developer in Punjab - Serving All Major Cities

Read More
How to Rank #1 on Google in Haryana & Punjab - Complete SEO Guide
SEO12 min

How to Rank #1 on Google in Haryana & Punjab - Complete SEO Guide

Read More