← Back to Blog

How to Integrate Razorpay on Your WooCommerce Custom Checkout Page: A Step-by-Step Guide for Indian Businesses

By WovLab Team | May 11, 2026 | 9 min read

Why a Custom Checkout with Razorpay is a Game-Changer for Indian Ecommerce

For any Indian business running on WooCommerce, the checkout process is the final, most critical step in the customer journey. A clunky, slow, or untrustworthy payment experience is the #1 reason for cart abandonment. This is where you must integrate Razorpay with your WooCommerce custom checkout page. Standard WooCommerce checkouts are functional, but they often lack the flexibility and branding needed to build user trust and maximize conversions. A custom checkout page allows you to control the entire user experience, from custom form fields to a design that perfectly matches your brand. When combined with Razorpay, India's leading payment gateway, you create a powerful, seamless, and highly converting payment flow. Razorpay supports all the payment methods Indian consumers expect: UPI (PhonePe, Google Pay, Paytm), all major credit and debit cards, net banking across 50+ banks, and popular wallets. This isn't just about aesthetics; it's about performance. A well-designed custom checkout with Razorpay can reduce payment friction, decrease load times, and significantly boost your conversion rate by offering a familiar and trusted payment interface.

A custom-tailored checkout experience isn't a luxury; it's a core conversion rate optimization (CRO) strategy. By removing unnecessary fields and branding the payment process, you can see a 10-20% uplift in successful transactions.

By tailoring the checkout, you can remove distracting, unnecessary fields and streamline the path to purchase. For example, you can pre-fill user information, offer dynamic shipping options based on location, and present payment options in a more intuitive layout. This level of customization, powered by a reliable gateway like Razorpay, directly translates to higher revenue and increased customer loyalty. It shows your customers that you are a professional, trustworthy brand that values their time and security. The ability to integrate Razorpay with a WooCommerce custom checkout page is no longer just an option—it's essential for serious ecommerce businesses in India.

Prerequisites: What You Need Before Starting the Integration

Before diving into the code and configuration, a bit of preparation is essential to ensure a smooth integration process. Rushing this stage often leads to frustrating errors and wasted time. First and foremost, you need an active Razorpay account. If you don't have one, head over to their website and complete the registration. The approval process is typically fast, especially if you have your business documents (like GSTIN and PAN card) ready. Once your account is approved, you will need to generate your API Keys. You'll find these in your Razorpay Dashboard under the "Settings" -> "API Keys" section. Generate a new set of keys and keep the Key ID and Key Secret safe; you'll need them shortly.

On the technical side, ensure your website meets these requirements:

Finally, always back up your website before making any changes. A full backup of your files and database is your safety net. Use a reliable backup plugin or your web host's backup feature. This simple step can save you from a major headache if anything goes wrong during the customization of your `functions.php` file or plugin installation. With your Razorpay keys in hand and a fresh backup, you're ready to start the integration.

Step-by-Step: Installing and Configuring the Razorpay for WooCommerce Plugin

The official Razorpay for WooCommerce plugin is the bridge between your store and the payment gateway. It’s a robust, well-maintained plugin that simplifies the most complex parts of the integration. Start by logging into your WordPress admin dashboard. Navigate to Plugins > Add New. In the search bar, type "Razorpay for WooCommerce". The official plugin, developed by Team Razorpay, should be the first result. Click Install Now and then Activate.

Once activated, a new "Razorpay" option will appear under your WooCommerce > Settings > Payments tab. Click on it to configure the gateway. This is where you'll connect your store to your Razorpay account. Here are the essential fields you need to fill out:

  1. Enable Razorpay: Check this box to make the gateway available on your checkout page.
  2. Title & Description: This is the text the customer sees. "Pay with UPI, Cards, Netbanking" or simply "Secure Online Payment" works well.
  3. Key ID & Key Secret: Carefully copy and paste the API keys you generated from your Razorpay dashboard. Be mindful not to mix them up.
  4. Payment Action: You have two options here. "Authorize" only verifies the payment and puts a hold on the funds; you must manually "capture" it later from your Razorpay dashboard to transfer the money. "Capture" automatically captures the payment immediately. For most businesses selling digital or physical goods, "Capture" is the recommended setting.

Choosing "Authorize" as the payment action is ideal for businesses that need to confirm stock availability or verify order details before charging the customer. For instant fulfillment, always choose "Capture".

After configuring these settings, save your changes. The Razorpay gateway is now technically active on your default WooCommerce checkout. You can do a quick test transaction to confirm it's working. However, the real power comes from customizing the checkout flow, which requires going beyond the plugin's default settings. This setup is the foundation upon which we will build our custom, high-converting payment experience.

The Code: Customizing Your `functions.php` for a Seamless Checkout Flow

This is where we move beyond the basics and truly integrate Razorpay with your WooCommerce custom checkout page. The goal is to modify the checkout process using WooCommerce hooks, which are placeholders in the code that allow us to add or remove functionality without editing core plugin files. The safest way to add custom PHP code is through your theme's `functions.php` file or, even better, a site-specific plugin. For this guide, we'll focus on the `functions.php` file, which is accessible via your WordPress dashboard under Appearance > Theme File Editor.

A common customization is to rearrange or remove unnecessary checkout fields. For instance, many Indian businesses don't need the 'Company Name' or 'Apartment, suite, unit, etc.' fields. Removing them reduces friction. Here's a code snippet to do just that:


add_filter( 'woocommerce_checkout_fields' , 'wovlab_remove_checkout_fields' );

function wovlab_remove_checkout_fields( $fields ) {
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_address_2']);
    return $fields;
}

Another powerful technique is to modify the behavior of the Razorpay payment modal itself. By default, the Razorpay logo is prominent. For a truly white-glove experience, you might want to replace it with your own brand's logo. You can do this by passing a custom image URL in the payment options. This requires hooking into the Razorpay arguments filter provided by their plugin:


add_filter( 'woocommerce_razorpay_args', 'wovlab_customize_razorpay_modal', 10, 2 );

function wovlab_customize_razorpay_modal( $args, $order_id ) {
    $args['image'] = 'https://www.wovlab.com/path/to/your/logo.png';
    // You can also pre-fill customer data
    $order = wc_get_order( $order_id );
    $args['prefill'] = array(
        'name'  => $order->get_billing_first_name() . ' ' . $order->get_billing_last_name(),
        'email' => $order->get_billing_email(),
        'contact' => $order->get_billing_phone()
    );
    return $args;
}

This snippet not only customizes the modal's image but also pre-fills the customer's contact details, saving them time and reducing the chance of typos. These are just two examples. Using WooCommerce hooks, you can change field labels, add custom validation, or even trigger unique actions after a successful payment. This level of control is what elevates a standard store to a professional ecommerce platform.

Testing and Troubleshooting Common Razorpay Integration Issues

After implementing your custom code, rigorous testing is not optional—it's essential. Even a small bug in the payment flow can cost you significant revenue. The first step is to enable Test Mode in your Razorpay dashboard. This allows you to perform transactions using dummy card details without any real money being charged. You'll find a separate set of API keys for Test Mode. Make sure to swap these into your WooCommerce Razorpay settings during testing.

Here are some common issues and how to troubleshoot them:

Issue Common Cause Solution
Payment Gateway Not Appearing Plugin not activated, SSL certificate missing, or currency not set to INR. Ensure the plugin is active, your site has HTTPS, and your WooCommerce store currency is Indian Rupees (₹).
"Bad Request: Payment Failed" Error Incorrect API Keys (e.g., using Test keys in Live mode or vice-versa). Double-check that you are using the correct Key ID and Key Secret for the selected mode (Test/Live).
Order Status Remains "Pending Payment" Webhook failure. Razorpay uses webhooks to notify your site about payment status. Go to your Razorpay Dashboard > Settings > Webhooks. Ensure the webhook URL (`https://yourdomain.com/?wc-api=razorpay_webhook`) is set up and active. Check for any errors in the webhook logs.
PHP Errors After Adding Code A syntax error (like a missing semicolon) in your `functions.php` file. If your site crashes, you'll need to access your files via FTP or your hosting control panel to fix the `functions.php` file. Always use a PHP code linter before saving changes.

The most common point of failure is a webhook misconfiguration. Your server's firewall or a security plugin might be blocking Razorpay's requests. Always check your webhook logs in the Razorpay dashboard first—they provide detailed information on what went wrong.

Go through the entire customer journey: add a product to the cart, proceed to your custom checkout page, and complete a payment using Razorpay's test card details. Check that the order is created successfully in WooCommerce and the status is updated to "Processing". Also, verify that the payment appears in your Razorpay test dashboard. A thorough testing process ensures a frictionless experience for your real customers when you go live.

Need Help? WovLab's Expert Developers Can Handle Your Payment Gateway Integration

While this guide provides a comprehensive walkthrough, we understand that not everyone has the time or technical expertise to dive into PHP code and troubleshoot server configurations. A faulty payment gateway is more than a technical glitch; it's lost revenue and damaged customer trust. That's where WovLab comes in. Our team of expert developers specializes in complex ecommerce solutions, including custom payment gateway integrations for Indian and international clients. We don't just install a plugin; we build seamless, high-performance checkout experiences tailored to your unique business needs.

Why choose WovLab for your integration?

Don't let technical challenges hold back your ecommerce growth. If you want to professionally integrate Razorpay with your WooCommerce custom checkout page, our team is ready to help. We ensure a flawless, secure, and highly converting payment system that aligns perfectly with your brand. At WovLab, we're more than just developers; we're your partners in digital success, offering a full suite of services from AI-powered solutions and cloud infrastructure to strategic SEO and digital marketing. Contact us today for a free consultation and let's build a checkout experience that delights your customers and drives your sales.

Ready to Get Started?

Let WovLab handle it for you — zero hassle, expert execution.

💬 Chat on WhatsApp