API ReferenceIntegrationsKnowledge Base

OpenCart Extension

OpenCart is an easy-to-use and powerful open source online store management program that can manage multiple online stores from a single admin interface. OpenCart is a module-based system which allows you to easily extend the functionality as per your needs.

Integrating your OpenCart site with Razorpay allows you to accept payments via the Razorpay Payment Gateway. You can accept payments via debit card, credit card, netbanking (supports 3D Secure), Unified Payments Interface (UPI) or through any of our supported wallets.

The extension offers seamless integration allowing the customer to pay on your website without being redirected. This allows the extension to work across all browsers and ensures compatibility with the latest version of OpenCart.

Currently, we support the following versions of OpenCart with separate extensions:

Video Tutorial🔗

Watch this video to learn how to integrate Razorpay Payment Gateway with your OpenCart website using our plugin.


  • Understand the payment flow process.
  • Sign up for a Razorpay Account.
  • Generate the API keys from the Razorpay Dashboard by navigating to Settings → API Keys. You can use the Test mode keys for testing and later switch to Live mode keys when going live with the integration.

Integration Steps🔗

  1. Install the Plugin.
  2. Configure OpenCart.
  3. Set Up Webhooks.
  4. Accept Live Payments.

Step 1: Install the Plugin🔗

  1. Download the latest Source code zip file of the required version of the plugin.
    1. Download the latest release of the OpenCart 3 plugin from the Releases section in GitHub. Tags for OpenCart 3 are opencart3-1.x.y.
    2. For OpenCart 2, download this release from GitHub. Tags for OpenCart 2 are opencart2-3.x.y.
    3. For OpenCart 1.5, download this release from GitHub. Tags for OpenCart 1.5 are opencart1.5-1.x.y.
  2. Copy all files/folders recursively to OpenCart installation directory.

Step 2: Configure OpenCart🔗

Configure OpenCart as given below:

  1. Log into OpenCart.
  2. Navigate to the Admin Panel and then to Extensions and Payments to install the Razorpay Payment Gateway extension.
  3. Click Edit and complete the following steps:
    1. Enter your Razorpay [KEY_ID] and [KEY_SECRET]. These can be generated from your Razorpay Dashboard.
    2. Change extension status to Enabled.
    3. Click Save to save the extension settings.

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.

Watch this video to see how to set up a webhook.

To set up webhooks:

  1. Log into the Razorpay Dashboard and navigate to SettingsWebhooks.

  2. Click the + Add New Webhook button.

  3. In the Webhook Setup pop-up page:

    1. Enter the URL where you want to receive the webhook payload when an event is triggered. We recommended using an HTTPS URL. Webhook URLs
      You can set up to 5 URLs to receive Webhook notifications. Webhooks can only be delivered to public URLs. If you attempt to save a localhost endpoint as part of a webhook setup, you will notice an error. Know more about testing Webhooks on an application running on localhost.
    2. 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. Know more about how to validate webhooks. Secret for Webhook
      • When setting up the webhook, you will be asked to specify a secret. Using this secret, you can validate that the webhook is from Razorpay. Entering the secret is optional but recommended. The secret should never be exposed publicly.
      • It is not necessary that the webhoook secret should be the merchant secret key provided by Razorpay.
    3. In the Alert Email field, enter the email address to which the notifications should be sent in case of webhook failure. You will receive webhook deactivation notifications to this email address.
    4. Select the required events from the list of Active Events.
  4. Click Create Webhook.

  5. After you set a webhook, it appears on the list of webhooks.

You can click Edit to make changes to the webhooks.

List of Events to Subscribe🔗

You must subscribe to the following events:

OpenCart Plugin Version

Webhook Events Supported

OpenCart 1.5


OpenCart 2.x


OpenCart 3.x

order.paid and payment.authorized

Step 4: Accept Live Payments🔗

After testing your OpenCart 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.
  2. Enter the Live mode [KEY_ID] and [KEY_SECRET] in your OpenCart store.

Address Verification System🔗

If you are accepting international payments, you can use Razorpay's Address Verification System (AVS). AVS verifies if a customer's billing address (postal code and the billing street address) matches the billing address on file with the card issuer. Based on the response from the issuer, Razorpay will accept or cancel the transaction. This helps in the prevention of fraud in international payments.

Know more about Address Verification System.