How to integrate Razorpay with a woocommerce store in wordpress?


Hey Champs!!,

Let's learn how to integrate Razorpay with your woocommerce store to make online payment. Are you the one running a woocommerce website but not able to find the best payment gateway for your store? Then this blog will help you a lot. Let’s dive in.

Woocommerce stores all need a payment gateway to allow customers to make a payment online. Ecommerce stores come with multiple payment methods like Cash on Delivery, Card, UPI, Net Banking, Wallet or EMI options too. So I personally prefer Razorpay because it is one of the best payment gateway and it is easy to integrate.

What is Razorpay?

Razorpay is one of India’s most popular payment gateways. It allows businesses to accept payments via:

  • UPI (Google Pay, PhonePe, Paytm, etc.)
  • Credit & Debit Cards
  • Net Banking
  • Wallets
  • EMI
  • Pay Later options

It’s trusted by thousands of Indian startups and enterprises because it’s reliable, developer-friendly, and integrates beautifully with WordPress.

If your WooCommerce store targets Indian customers, Razorpay is honestly a no-brainer.

Why Use Razorpay with WooCommerce?

Before we jump into setup, here’s why Razorpay + WooCommerce is a power combo:

1. Supports UPI (Massive in India)

UPI is dominating Indian digital payments. If your store doesn’t support UPI, you’re losing conversions.

2. Easy Integration

There’s an official plugin made specifically for WooCommerce.

3. Smart Checkout Experience

Cleaner interface. Faster checkout. Better conversion rates.

4. Automated Payment Confirmation

No manual checking. Orders update automatically after successful payment.

5. Advanced Features

  • Subscriptions
  • Payment links
  • Refund management
  • Detailed analytics

Now let’s integrate it properly.

Step-by-Step: Integrating Razorpay with WooCommerce

Step 1: Create a Razorpay Account

Go to Razorpay’s official website and sign up/login if you already have an account.




Add mobile number and verify with OTP.



Update the details like

  • Name
  • Accept payments on
  • Website link
  • Business type

If you have registered the shop then click the option according and i you are a newbie then select the option “individual”

  • PAN Number
  • Confirm name
  • Business name
  • Brand name
  • Email

Review everything you entered and click submit. After submitting documents, the next steps we goes to KYC.

Step 2: KYC Verification

On KYC it asks for some basic information about your business.

Details like:

  • Bank Details
  • Business Address
  • Business Category
  • Business Documents
  • Business Policy
  • GST Details
  • Identity Proof

Then select your business model and submit it. It takes 3 to 4 working days to complete your KYC.

Once activated, you’ll get access to the Razorpay Dashboard.

Step 3: Install the Razorpay Plugin

Now go to your WordPress dashboard.

  • Go to Plugins → Add New
  • Search for “Razorpay for WooCommerce”
  • Install and activate the official plugin by Razorpay

Make sure WooCommerce is already installed and set up.

The official plugin is built to work directly with:

WooCommerce

No custom coding needed (unless you want advanced customization).

Step 3: Set it up - Razorpay

Go to Woocommerce plugin and under settings go to payment make sure you have enabled the razorpay.  Now we need to connect your WooCommerce store to Razorpay using API keys.

To get your keys:

  • Login to Razorpay Dashboard
  • Go to Settings → API Keys
  • Click Generate Key

You’ll get:

  • Key ID
  • Key Secret

⚠️ Keep the Key Secret private. Never share it publicly.

Step 4: Configure Razorpay in WooCommerce

Now head back to WordPress.

  • Go to WooCommerce → Settings
  • Click on the Payments tab
  • Find “Razorpay”
  • Click Manage

Now configure the following:

Enable Razorpay

Turn it on.

Title & Description

This appears on checkout page. Example:
“Pay securely via UPI, Cards, Net Banking, and more.”

API Key ID

Paste the Key ID from Razorpay.

API Key Secret

Paste the Key Secret.

Enable Test Mode (Important Initially)

Before going live, enable Test Mode to check if payments work correctly.

Click Save Changes.

Step 5: Test Razorpay Integration

Never go live without testing. Ever. Because once the website goes live with a bad payment gateway it collapses your entire site. 

In Test Mode, Razorpay provides dummy card details.

Use:

  • Card Number: 4111 1111 1111 1111
  • Any future expiry date
  • Random CVV

Place a test order from your website.

If everything is configured correctly:

  • Payment should be successful
  • Order status should update to “Processing”
  • You should see the transaction in Razorpay dashboard (Test mode)

If not, check:

  • API keys
  • Test mode enabled
  • Webhook settings (we’ll discuss next)

Step 6: Setup Webhooks (Important for Automation)

Webhooks allow Razorpay to notify WooCommerce about payment status changes.

Without webhooks, some orders may remain stuck in “Pending.”

To set up webhook:

  • Go to Razorpay Dashboard
  • Navigate to Settings → Webhooks
  • Click Add New Webhook

Enter: Your website webhook URL It usually looks like: https://yourdomain.com/?wc-api=razorpay

Select events:

  • payment.authorized
  • payment.captured
  • payment.failed

Save it.

Now copy the webhook secret and paste it into WooCommerce Razorpay settings.

This ensures real-time order updates.

Step 7: Disable Test Mode and Go Live

Once everything works perfectly in Test Mode:

  • Disable Test Mode in WooCommerce settings
  • Switch Razorpay Dashboard to Live Mode
  • Generate Live API Keys
  • Replace test keys with live keys

Save changes.

Boom. You’re officially accepting real payments 🎉

Common Issues and How to Fix Them

Let’s be real. Sometimes things break. Here’s how to handle it.

1. Payment Successful but Order Still Pending

Cause:
Webhook not configured properly.

Fix:
Recheck webhook URL and secret key.

2. Payment Failed Repeatedly

Cause:

  • Invalid API keys
  • Account not fully activated
  • Domain not added in Razorpay settings

Fix:
Verify live keys and account approval status.

3. Checkout Page Freezes

Cause:
JavaScript conflict with theme or plugin.

Fix:

  • Switch to default theme temporarily
  • Disable unnecessary plugins
  • Check console errors

Advanced Tips for Better Conversion

If you’re serious about scaling your WooCommerce store, don’t just install and forget. Optimize.

1. Enable Smart Checkout

Razorpay offers a modern checkout interface that improves mobile conversions.

Mobile traffic in India = huge. Don’t ignore it.

2. Optimize WooCommerce Checkout Page

Remove distractions:

  • Disable unnecessary fields
  • Reduce page load time
  • Optimize hosting

A slow checkout kills sales.

3. Enable Automatic Refunds

From Razorpay dashboard, you can issue refunds directly.

WooCommerce order status updates automatically.

This improves customer trust.

4. Use Razorpay Subscriptions (If Needed)

If you’re running membership or recurring services, Razorpay supports subscriptions.

Works well with:

  • WooCommerce Subscriptions plugin
  • Membership plugins

Is Razorpay Secure?

Yes.

Razorpay is PCI-DSS compliant and follows RBI guidelines.

Customer card data is handled securely on Razorpay’s servers — not your WordPress hosting.

That means less compliance headache for you.

Razorpay Fees (Know Before You Start)

Typical charges:

~2% per successful transaction (varies by payment type)

Always check latest pricing on Razorpay’s official website because rates may change.

When Should You NOT Use Razorpay?

Let’s be honest.

If:

  • You’re targeting mostly international customers
  • You need heavy multi-currency support
  • You operate outside India

Then gateways like Stripe or PayPal might be better.

But for Indian market? Razorpay wins.

Final Thoughts

Integrating Razorpay with WooCommerce is honestly one of the smartest moves for Indian online stores.

The setup is simple:

  • Create account
  • Install plugin
  • Add API keys
  • Setup webhook
  • Test
  • Go live

That’s it.

If you’re a WordPress developer managing client stores, this integration should be part of your standard toolkit. Clean setup + proper testing = zero payment drama.

And trust me — when payments work smoothly, customers trust your brand more.


Post a Comment

Previous Post Next Post