1. Build Integration

Follow the step-by-step guide on how to integrate the Razorpay Payment Gateway with your Magento 1.x and 2.x (Adobe Commerce) Extensions.


Follow the steps given below to integrate Razorpay Payment Gateway with your Magento 1.x and 2.x Extensions.

  1. .
  2. .

Follow the steps given below to download and install Magento 1.x Extension.

  1. the Razorpay-1.1.31.tgz file from the latest release.

  2. If you have Onepage Checkout (IWD or Fire Checkout),

    the Source Code zip from the latest release. With Onepage Checkout you can gather the required information from the shopper and complete the checkout process quickly. When Onepage Checkout is enabled, the entire checkout process takes place on a single page.

You can install the repository in two ways:

  1. Go to Magento Connect Manager.
  2. Go to Direct package file upload.
  3. Click Choose File and select the TGZ file from Step 1.
  4. Click upload.

  1. Unzip and open the downloaded folder.
  2. Copy the app folder.
  3. Paste and merge it into the Magento root folder.
  4. Copy the js folder.
  5. Paste and merge it into the Magento root folder.

Once installed, navigate to Configuration and then to Payment Gateways and

to suit your needs.

To configure your Magento store for Razorpay:

  1. Log in to your

    .

  2. Click on the System tab and then select Configuration option from the drop-down list.

  3. Click Payment Methods in the menu panel.

  4. Scroll down. Click Razorpay and enter your test mode [KEY_ID] and [KEY_SECRET].

  5. Select Yes for the Enabled option.

  6. Click Save Config button. This activates your account in the Test Mode. You can use this account to make a few test payments to ensure a successful workflow.

    Handy Tips

    In test mode, no real money is deducted from your account.

  1. .
  2. .
  3. .

You can install the extension through two ways:

  1. Install the extension on your Magento store using the Composer Package Manager. Composer is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries.

  2. Go to your installation root directory of Magento and execute the following command:

    composer require razorpay/magento
    bin/magento module:enable Razorpay_Magento
  3. You can check if the installation was successful by executing the following command in the Magento root directory.

    bin/magento module:status

    Handy Tips

    You should see Razorpay_Magento in the status. It might appear on the disabled modules list.

  4. Enable and deploy the Razorpay module using commands:

    bin/magento module:enable Razorpay_Magento
    bin/magento setup:di:compile
    bin/magento setup:upgrade
    bin/magento cache:flush
    bin/magento setup:static-content:deploy

Upgrade Magento Extension

If you are an existing extension user, you can

to the latest version using the composer.

  1. Download the code.zip file from the

    . Extract the zip.

  2. Place the code folder from Step 1 in your app folder. If you're performing an update, replace/overwrite the existing code folder.

  3. Enable and deploy the Razorpay module using commands:

    bin/magento module:enable Razorpay_Magento
    bin/magento setup:upgrade
  4. Install Magento cron jobs using the command:

    bin/magento cron:install
  5. Enter the following command to compile the dependency code:

    bin/magento setup:di:compile
  6. Enter the following command to upgrade the Razorpay Magento module from the Magento installation folder:

    bin/magento setup:di:upgrade
  7. On the Magento admin dashboard, open Razorpay payment method settings and click Save Config.

    Watch Out!

    If you see the message One or more of the Cache Types are invalidated: Page Cache. highlighted in yellow on the Admin page, go to Cache Management and refresh cache types.

  8. Run the following command:

    bin/magento cache:flush

To configure your Magento store for Razorpay:

  1. Log in to your

    .

  2. Choose Stores on the Admin sidebar to the left. Now go to SettingsConfiguration.

  3. In the Configuration page, click on Sales on the left and choose Payment Methods.

  4. In the Payment Methods page, navigate to Razorpay.

  5. Enter your test mode [KEY_ID] and [KEY_SECRET]. These can be

    .

  6. Select Yes for the option Enabled.

  7. Click Save Config. This activates your account in the test mode. You can use this account to make a few test payments and ensure a successful workflow.

    Handy Tips

    In test mode, no real money is deducted from your account.

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 against 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

.

Handy Tips

  • If you are using Magento plugin version 3.4.1, ensure the webhook delay is set to a minimum of 300 seconds.
  • Webhook is auto-configured on Magento plugin version 3.8.1-beta and above. For versions lower than 3.8.1-beta, you should .

To set up webhooks in the

:

  1. Log in to the Razorpay Dashboard.
  2. Navigate to SettingsWebhooks.
  3. Click + Add New Webhook.
  4. In the Webhook Setup modal:
    • Paste the URL copied from the Magento site.

      Handy Tips

      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

      section for alternatives to localhost.

    • Enter the Secret you had provided on the Magento site. The secret is used to validate that the webhook is from Razorpay. Do not expose the secret publicly. Know more about

      .

    • In the Alert Email field, enter the email address to which notifications must be sent in case of webhook failure.

    • Select only the order.paid event from the list of Active Events.

  5. Click Create Webhook.

Know more about

.

Handy Tips

If the notification says Razorpay table is not set up correctly, please contact the

.

Setup cron with Magento to execute Razorpay cronjobs for the following actions:

It will cancel the order created by Razorpay according to the timeout saved in the configuration if Cancel Pending Order is enabled.

Accepts response from Razorpay Webhook for events payment.authorized and order.paid and updates pending order to processing.

Install Magento cron jobs using the command:

bin/magento cron:install

You can track the payment status in three ways:

Handy Tips

  • On the Dashboard, ensure that the payment status is captured. Refer to the payment capture settings page to know how to .
  • Subscribe to our webhooks or poll the Fetch a Payment API to track the payment status.

To verify the payment status from the Dashboard:

  1. Log in to the and navigate to TransactionsPayments.
  2. Check if a Payment Id has been generated and note the status. In case of a successful payment, the status is marked as Captured.
Check if the payment id is generated and the status is captured

You can use Razorpay webhooks to configure and receive notifications when a specific event occurs. When one of these events is triggered, we send an HTTP POST payload in JSON to the webhook's configured URL. Know how to

If you have subscribed to the order.paid webhook event, you will receive a notification every time a customer pays you for an order.

to check the payment status.

Step 2:


Is this integration guide useful?