Logo of WooCommerce

WooCommerce

Online Store Builder

A flexible, open-source eCommerce platform. Built on WordPress.

Whether you’re launching a business, taking an existing brick and mortar store online, or designing sites for clients, get started quickly and build exactly the store you want.

The first decisions you need to make when setting up a store are about homepage design, menus, site structure, and payment and shipping options. If you have a WordPress site, adding WooCommerce takes just minutes!

Built on WordPress, the WooCommerce dashboard is a familiar interface for store managers to update products and fulfill orders. Save time with automated tax calculations, live shipping rates from leading carriers, options to print labels at home, and the mobile app for iOS and Android.

How to use Razorpay with WooCommerce

Step 1: Install Plugin

There are two methods to install the Razorpay WooCommerce plugin:

  • Download the plugin from WordPress plugin directory
  • OR Install plugin manually

Install via the WordPress Plugin Directory

  1. Download the plugin and install it from the WordPress Plugin Directory.

Manual Installation

  1. Download thelatest Source code zip file from the Releases section in GitHub.
  2. Unzip and upload contents of the extension to your/wp-content/plugins/directory.

Step 2: Configure WooCommerce

  1. Log into yourWordPress account and activate the Razorpay plugin in the WordPress Plugin Manager.
  2. Log into yourWooCommerce account , navigate to Settings and click theCheckout/Payment Gateways tab.
  3. Click Razorpay to edit the settings.
  4. Enable the Payment Method, name it Credit Card / Debit Card / Internet Banking (This is shown on the Payment page your customer sees.).
  5. Add in your <key_id>and<key_secret> generated from the Razorpay Dashboard.
  6. Set the Payment Action to Authorize and Capture to auto-capture payments. If you want to capture payments manually from the Dashboard after manual verification, set the Payment Method to Authorize.

Step 3: Set Up Webhooks

Webhooks are triggered when certain events occur. Subscribe to webhook events to receive notification (in the form of a webhook payload) when these events occur. Setting up webhooks makes your integration more robust, and guards again issues arising from poor connectivity. The webhook URL is available on the plugin's settings page. You must copy it from there and use it to set up webhook on the Razorpay Dashboard.

You can set up multiple URLs to receive webhook notifications.

To setup webhooks:

  1. Log into yourRazorpay Dashboard and navigate to SettingsWebhooks.
  2. Click + Add New Webhook.

    Add new webhook button on top right of the screen
  3. In the Webhook Setup modal:
    • Enter the URL where you want to receive the webhook payload when an event is triggered. We recommended using an HTTPS URL.Note:
      Webhooks can only be delivered to public URLs. If you attempt to save a localhost endpoint as part of a webhook set-up, you will notice an error. Please refer to the test webhooks section for alternatives to localhost.
    • Enter a Secret for the webhook endpoint. The secret is used to validate that the webhook is from Razorpay. Do not expose the secret publicly.Learn more about Webhook Secret.
    • In the Alert Email field, enter the email address to which notifications must be sent in case of webhook failure.
    • Select the required events from the list of Active Events.Sample payloads for all events are available.
    Webhook setup page
  4. Click Create Webhook.
  5. Once created, it appears on the list of webhooks:

    Table of webhooks with created webhook listed on it
  6. Watch the short animation for more details.

    Animations of above steps

List of Events to Subscribe

You must subscribe to the following events:

Plugin

Webhook Events Supported

WooCommerce

payment.authorized and payment.failed

Step 4: Accept Live Payments

After testing your WooCommerce store, when you are ready to accept live payments:

  1. Generate the <key_id> and <key_secret> in the Live mode on your Razorpay Dashboard.

    Animations of clicking buttons in following format: Settings then API Keys then Generate Live Keys
  2. Enter the Live mode <key_id>and<key_secret>in your WooCommerce store.