Paramclasses Academy - Blog

Tutorials Details

←
Post 27 of 40
→

How to setup WooCommerce Payment Gateway Setup: Accept Online Payments ?

How to setup WooCommerce Payment Gateway Setup: Accept Online Payments  ?

November 16, 2026

1. Introduction to Payment Gateways

In the previous tutorials, we created a WooCommerce store, added products, configured categories, and created product variations.

Now we will learn how to accept online payments from customers.

A payment gateway is a service that securely processes online transactions between customers, merchants, banks, and payment networks.

When a customer purchases a product from your WooCommerce store, the payment gateway helps process the payment and communicates the transaction result to your website.

For example, a customer purchases a product worth ₹1,499 and selects UPI as the payment method.

The general payment process is:

  1. Customer adds a product to the cart.

  2. Customer opens the checkout page.

  3. Customer selects a payment method.

  4. WooCommerce sends the customer to the payment gateway or opens its payment interface.

  5. Customer completes the payment.

  6. The payment gateway processes the transaction.

  7. WooCommerce receives the payment result.

  8. The order status is updated according to the payment result.

In this tutorial, we will use Razorpay as our practical payment gateway example because it provides a WooCommerce integration for eligible merchants in India.

We will also understand offline payment methods, API keys, test mode, webhooks, payment verification, and live payment configuration.

Official reference: Razorpay WooCommerce Integration

2. What Is a Payment Gateway?

A payment gateway is a technology service that connects an online store with payment processing infrastructure.

It allows customers to pay for products or services using supported payment methods.

Depending on the provider, payment methods may include:

  • UPI.

  • Credit cards.

  • Debit cards.

  • Net banking.

  • Digital wallets.

  • Other supported payment options.

Popular payment gateway providers and services include:

  • Razorpay.

  • Cashfree Payments.

  • PayU.

  • Stripe.

  • PayPal.

Availability depends on the merchant's country, business category, account approval, and provider policies.

Payment Gateway vs Payment Method

These two terms are related but different.

Payment Gateway: The service or integration that processes online payments.

Payment Method: The actual option selected by the customer, such as UPI, credit card, or net banking.

For example:

Razorpay = Payment Gateway

UPI = Payment Method

3. What Is Razorpay?

Razorpay is an online payment service provider that offers payment gateway integrations for supported businesses.

Its WooCommerce integration can allow eligible merchants to accept supported online payment methods through their WordPress store.

Depending on account approval and payment-method availability, customers may be able to pay using:

  • UPI.

  • Credit cards.

  • Debit cards.

  • Net banking.

  • Wallets.

  • Other approved payment options.

Before integrating Razorpay, you should have:

  1. A working WordPress website.

  2. WooCommerce installed and activated.

  3. A suitable HTTPS-enabled website.

  4. A Razorpay account.

  5. Completed business verification and activation requirements.

  6. Access to the Razorpay Dashboard.

Important: Creating a Razorpay account does not automatically mean that live payment processing is enabled. Complete the provider's required verification and activation steps.

Official reference: Razorpay WooCommerce Prerequisites

4. Understand Razorpay Test Mode and Live Mode

Before configuring the gateway, understand its two operating modes.

A. Test Mode

Test Mode is used to simulate payment transactions during development.

It helps you check whether:

  • The payment gateway opens correctly.

  • The checkout process works.

  • Test payments succeed or fail correctly.

  • WooCommerce receives transaction updates.

  • Orders are updated correctly.

No real money is transferred during a properly configured test transaction.

B. Live Mode

Live Mode is used to accept actual customer payments.

When the gateway is configured with valid live credentials and the merchant account is activated, customers can make real transactions.

Important: Never use live credentials for practice testing. Always complete your test transactions using Test Mode credentials first.

5. Create a Razorpay Account

Step 1: Open the Razorpay Website

Visit:

https://razorpay.com/

Step 2: Create an Account

Click the Sign Up option.

Enter the requested account details.

Step 3: Complete Business Information

Provide the information requested by Razorpay, which may include:

  • Business name.

  • Business type.

  • Contact details.

  • Business website.

  • Bank account information.

  • Required identity and business documents.

Step 4: Complete Verification

Follow the verification and activation process shown in your Razorpay Dashboard.

The exact requirements depend on your business type and the provider's current policies.

Step 5: Open the Dashboard

After account creation, log in to:

https://dashboard.razorpay.com/

You will use this dashboard to manage API keys, payments, refunds, and other payment-related activities.

6. Install the Razorpay WooCommerce Plugin

Now we will connect Razorpay with our WordPress website.

Step 1: Open WordPress Dashboard

Log in to:

https://yourdomain.com/wp-admin

Step 2: Open Plugins

Navigate to:

Dashboard → Plugins → Add New Plugin

Step 3: Search for Razorpay

Enter:

Razorpay for WooCommerce

Find the official Razorpay integration plugin.

Check its publisher, compatibility, and latest update information before installation.

Step 4: Install the Plugin

Click Install Now.

Wait until the installation is completed.

Step 5: Activate the Plugin

Click Activate.

The Razorpay payment gateway integration should now be available for configuration.

Official plugin: Razorpay for WooCommerce on WordPress.org

7. Generate Razorpay API Keys

API keys are used to authenticate communication between your WooCommerce website and Razorpay.

You generally need two credentials:

Key ID: Identifies the API credentials used by the integration.

Key Secret: A confidential credential used for secure authentication.

Never share your Key Secret publicly.

Step 1: Open Razorpay Dashboard

Log in to your Razorpay account.

Step 2: Select Test Mode

Switch to Test Mode before generating practice credentials.

Step 3: Open Account Settings

Navigate to:

Account & Settings → API Keys

The exact dashboard layout may change over time.

Step 4: Generate Test API Keys

Click the option to generate a Test Mode key.

Razorpay will provide the API credentials.

Step 5: Save the Credentials Securely

Keep the following values available:

  • Test Key ID.

  • Test Key Secret.

Store them securely. Do not paste them into public documents, screenshots, tutorials, or source-code repositories.

Official reference: Razorpay API Keys

8. Configure Razorpay in WooCommerce

Now we will connect the API credentials with our WordPress website.

Step 1: Open WooCommerce Settings

Navigate to:

Dashboard → WooCommerce → Settings

Step 2: Open Payments

Click the Payments tab.

Step 3: Find Razorpay

Locate Razorpay in the available payment methods.

Click Manage or the corresponding configuration link.

Step 4: Enable Razorpay

Enable the payment method using the available checkbox or toggle.

Step 5: Configure the Display Title

The title is displayed to customers during checkout.

Example:

Pay Securely with Razorpay

Step 6: Add a Description

Enter a short explanation.

Example:

Pay using supported UPI, debit card, credit card, net banking, and other available payment methods.

Only mention methods that are actually enabled and supported for your account.

Step 7: Enter Test API Credentials

Copy the Test Key ID from your Razorpay Dashboard and paste it into the appropriate field.

Copy the Test Key Secret and paste it into its corresponding field.

Make sure both credentials belong to Test Mode.

Step 8: Configure Payment Action

Depending on the plugin version, you may see a Payment Action setting.

Common options include:

  • Authorize.

  • Authorize and Capture.

Authorize and Capture is generally suitable for a basic store that wants successful payments captured automatically.

Authorization-only workflows require an additional capture step. Do not leave authorized payments uncaptured.

Step 9: Save Changes

Click Save changes.

Your Razorpay integration is now configured with Test Mode credentials.

Official reference: Razorpay WooCommerce Integration Steps

9. Understand Payment Capture

Payment authorization and payment capture are two different stages.

Payment Authorization

Authorization means the payment has been approved or the amount has been reserved according to the payment method and transaction flow.

It does not necessarily mean that the funds have been captured.

Payment Capture

Capture is the process of completing the authorized payment so it can proceed through the settlement process.

For a basic store, automatic capture can simplify payment processing.

If your integration uses authorization without automatic capture, you must ensure that payments are captured within the applicable time window.

Razorpay documents that authorized payments left uncaptured beyond its specified period can be automatically refunded.

Best Practice: Verify that your payment capture configuration matches your WooCommerce gateway settings.

10. Configure Webhooks

A webhook is an automated notification sent by one application to another when a specific event occurs.

In an online store, webhooks help WooCommerce receive important payment updates.

For example:

  • Payment authorized.

  • Payment captured.

  • Payment failed.

  • Order paid.

These notifications help synchronize payment status with the WooCommerce order.

Configure Razorpay Webhooks

For supported versions of the Razorpay WooCommerce plugin, webhook configuration can be performed automatically when valid API credentials are saved.

Follow these steps:

  1. Save your Razorpay API credentials in the WooCommerce gateway settings.

  2. Open the Razorpay Dashboard.

  3. Navigate to Account & Settings.

  4. Open Webhooks.

  5. Check whether the required webhook configuration is enabled.

  6. Verify the relevant payment events.

For supported integrations, events may include:

  • payment.authorized

  • payment.captured

  • payment.failed

  • order.paid

Older plugin versions may require manual webhook configuration.

If you regenerate API keys, save the new credentials in the WooCommerce settings and verify the webhook configuration again.

Why Are Webhooks Important?

Suppose a customer completes a payment, but the browser closes before the customer returns to the order confirmation page.

A properly configured payment notification can help your store receive the transaction update even when the customer does not complete the normal browser return flow.

Official reference: Razorpay Webhook Configuration

11. Test Razorpay Payment Integration

Before accepting real payments, test the complete checkout process.

Step 1: Open Your Store

Visit the frontend of your WooCommerce website.

Step 2: Select a Product

Open a published product and add it to the cart.

For practice, you can use:

Premium Wireless Headphones

Step 3: Open the Cart

Verify the product name, quantity, and price.

Step 4: Open Checkout

Enter sample customer and billing details.

Step 5: Select Razorpay

Choose the Razorpay payment option.

Step 6: Continue to Payment

Click the payment button.

The test payment interface should open.

Step 7: Use Test Payment Details

For a Razorpay Test Mode UPI transaction, the official documentation provides these sample UPI IDs:

Successful test payment:

success@razorpay

Failed test payment:

failure@razorpay

These are test credentials, not real customer UPI IDs.

You can also use the test card information provided in the official Razorpay documentation.

Step 8: Complete the Test Transaction

Perform a successful test payment.

Verify that the payment result is returned to your website.

Step 9: Check WooCommerce Orders

Navigate to:

Dashboard → WooCommerce → Orders

Open the test order.

Check its payment information, transaction details, and order status.

Step 10: Verify Razorpay Dashboard

Open the Razorpay Dashboard and navigate to:

Transactions → Payments

Verify that the test transaction is visible with the expected status.

Official reference: Razorpay Test Integration

12. Understand WooCommerce Order Statuses

After a payment attempt, WooCommerce updates the order status according to the payment result and fulfilment process.

Some common statuses include:

Pending Payment

The order has been created but payment has not been confirmed.

Processing

Payment has been received, and the order is awaiting fulfilment.

For physical products, this is a common status after successful payment.

Completed

The order has been fulfilled successfully.

On Hold

The order is waiting for confirmation or another manual action.

Failed

The payment was unsuccessful or declined.

Cancelled

The order has been cancelled.

Refunded

The order has been refunded.

Always check the payment transaction and order notes before changing order statuses manually.

13. Configure Offline Payment Methods

WooCommerce also supports offline payment methods.

These methods do not require the same online payment gateway flow.

Navigate to:

WooCommerce → Settings → Payments

You may find options such as:

A. Direct Bank Transfer

Customers receive your bank transfer instructions and pay directly to your business bank account.

The order generally remains on hold until the payment is verified.

B. Cash on Delivery

Customers pay when the order is delivered.

This option is useful for businesses that offer cash collection at delivery.

C. Check Payments

Customers pay through a cheque or another supported offline process.

These methods must be managed according to your actual business operations.

For example, do not mark a bank transfer order as paid until you have verified the payment in your bank account.

Official reference: WooCommerce Payment Settings

14. Switch from Test Mode to Live Mode

After successfully testing your integration, you can prepare your store for real payments.

Do not switch to Live Mode until your merchant account and website are ready.

Step 1: Complete Razorpay Account Activation

Make sure your business verification and activation requirements have been completed.

Step 2: Open Razorpay Dashboard

Log in to your Razorpay account.

Step 3: Switch to Live Mode

Select Live Mode in the Razorpay Dashboard.

Step 4: Generate Live API Keys

Navigate to:

Account & Settings → API Keys

Generate your Live Mode credentials.

Step 5: Open WooCommerce Payment Settings

Navigate to:

WooCommerce → Settings → Payments → Razorpay

Step 6: Replace Test Credentials

Replace the Test Key ID with your Live Key ID.

Replace the Test Key Secret with your Live Key Secret.

Never mix a Test Key ID with a Live Key Secret or vice versa.

Step 7: Save Changes

Click Save changes.

Step 8: Verify Webhooks

Check the webhook configuration in the Razorpay Dashboard.

Step 9: Review the Checkout Page

Confirm that the payment method is enabled and that the checkout experience is working correctly.

Important: Live Mode transactions involve real money. Only use live credentials after completing all verification and testing steps.

15. Secure Your Payment Gateway Integration

Payment security is essential for an e-commerce website.

Follow these practices:

  • Always use HTTPS.

  • Keep WordPress and WooCommerce updated.

  • Install payment plugins from trusted sources.

  • Never expose your API Secret.

  • Never store customer card details unnecessarily.

  • Use the payment provider's supported checkout integration.

  • Enable and verify payment notifications.

  • Restrict WordPress administrator access.

  • Maintain regular website backups.

  • Review failed transactions and suspicious activity.

  • Use a staging website to test major changes.

  • Verify captured payments before fulfilling orders.

Important: A valid SSL certificate is essential for protecting data exchanged between customers and your website. HTTPS alone does not make an entire payment integration secure; the gateway and website must also be configured correctly.

16. Common Payment Gateway Problems and Solutions

Problem 1: Razorpay Is Not Displaying at Checkout

Possible causes:

  • Plugin is not activated.

  • Payment method is disabled.

  • Plugin is outdated.

  • Checkout page has configuration issues.

  • Another plugin or theme is creating a conflict.

Solution:

Verify plugin activation, enable the payment method, update the integration, and test the checkout page.

Problem 2: Invalid API Key Error

Possible causes:

  • Incorrect Key ID.

  • Incorrect Key Secret.

  • Test and Live credentials are mixed.

  • Old credentials are being used.

Solution:

Generate or copy the correct credentials from the appropriate Razorpay mode and update the WooCommerce settings.

Problem 3: Payment Is Successful but Order Remains Pending

Possible causes:

  • Webhook configuration issue.

  • Payment notification failure.

  • Plugin compatibility problem.

  • Server communication issue.

Solution:

Check the Razorpay transaction, webhook configuration, WooCommerce order notes, and gateway logs.

Never mark an order as paid only because a customer shows a screenshot of a successful payment.

Problem 4: Payment Window Is Not Opening

Possible causes:

  • JavaScript errors.

  • Browser blocking behavior.

  • Plugin conflicts.

  • Incorrect gateway configuration.

Solution:

Check the browser console, update the payment plugin, clear the cache, and test with a compatible theme in a staging environment.

Problem 5: Payment Failed

Possible causes:

  • Invalid test payment details.

  • Customer's payment method declined the transaction.

  • Gateway configuration problem.

  • Payment session expired.

Solution:

Review the transaction status in the Razorpay Dashboard and inspect the WooCommerce order notes.

Problem 6: Webhook Is Not Updating Orders

Possible causes:

  • Incorrect webhook configuration.

  • Webhook events are disabled.

  • Old plugin version.

  • Server is blocking incoming requests.

Solution:

Verify the webhook URL and event configuration, update the plugin, and inspect the provider and WooCommerce logs.

Official reference: WooCommerce Payment Error Troubleshooting

17. Practical Assignment

Create a payment-enabled practice store.

Project Name: Param Store Payment Integration

Complete the following tasks:

  1. Open your WordPress website.

  2. Confirm that WooCommerce is installed.

  3. Create or access a Razorpay test account.

  4. Install the Razorpay WooCommerce plugin.

  5. Activate the plugin.

  6. Generate Test Mode API credentials.

  7. Configure Razorpay in WooCommerce.

  8. Enable the Razorpay payment method.

  9. Save the payment settings.

  10. Open your online store.

  11. Add a product to the cart.

  12. Open the checkout page.

  13. Select Razorpay.

  14. Complete one successful test UPI payment.

  15. Perform one failed test payment.

  16. Open WooCommerce → Orders.

  17. Verify the order statuses.

  18. Open Razorpay → Transactions → Payments.

  19. Verify the corresponding test transactions.

  20. Check that webhook events are enabled.

Expected Result: A WooCommerce store with a configured Razorpay Test Mode integration, successful and failed test transactions, and verified order updates.

Do not switch to Live Mode as part of this practice assignment unless your business account is approved and you are ready to accept real payments.

18. Frequently Asked Questions

Q1. What is a payment gateway in WooCommerce?

A payment gateway is a service that allows WooCommerce stores to accept and process online customer payments.

Q2. Is Razorpay free to install?

The Razorpay WooCommerce integration plugin is available without a plugin purchase through the WordPress plugin directory. However, payment processing may involve provider fees and account-specific commercial terms.

Q3. What are Razorpay API keys?

API keys are credentials used to authenticate communication between your WooCommerce website and Razorpay.

Q4. What is the difference between Test Mode and Live Mode?

Test Mode simulates transactions without transferring real money. Live Mode processes actual customer payments.

Q5. Can WooCommerce accept UPI payments?

Yes. WooCommerce can support UPI through a compatible payment gateway integration, subject to provider availability and merchant approval.

Q6. What is a webhook?

A webhook is an automated notification sent when an event occurs, such as a payment being captured or failing.

Q7. What happens when a payment fails?

The payment gateway reports the failure, and WooCommerce generally updates the order status to Failed or another appropriate status.

Q8. Can WooCommerce accept Cash on Delivery?

Yes. Cash on Delivery is available as an offline payment method in WooCommerce.

Q9. Can I use Razorpay on a localhost website?

You can use supported Test Mode integration for local development, provided your setup meets the plugin's requirements and the gateway can communicate with your local environment. A publicly accessible website or properly configured tunnel may be needed for some webhook testing scenarios.

Q10. Should I share my API Secret with a developer?

Never share API secrets publicly. If a developer needs access, use secure credential-sharing practices and grant only the access required. Rotate credentials if they are exposed.

19. Conclusion

In this tutorial, we learned how to configure an online payment gateway in WooCommerce.

We covered Razorpay account setup, plugin installation, API key generation, payment configuration, payment capture, webhooks, Test Mode, Live Mode, offline payment methods, and troubleshooting.

We also learned how to verify successful and failed transactions through the WooCommerce and Razorpay dashboards.

A properly configured payment gateway is an essential part of a professional e-commerce website. Always test the complete payment flow before accepting real customer transactions.

←
Post 27 of 40
→