Integration Steps
Steps to integrate your Magento Extensions with Razorpay Payment Gateway.
Follow the steps given below to integrate Razorpay Payment Gateway with your Magento website.
Follow the steps given below to integrate Razorpay Payment Gateway with your Magento 1.x and 2.x Extensions.
Follow the steps given below to download and install Magento 1.x Extension.
- the
Razorpay-1.2.1.tgz
file from the latest release. - 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:
- Go to Magento Connect Manager.
- Go to
Direct package file upload
. - Click
Choose File
and select the TGZ file from Step 1. - Click
upload
.
Once installed, navigate to Configuration and then to Payment Gateways and
to suit your needs.To configure your Magento store for Razorpay:
- Log in to your .
- Click on the System tab and then select Configuration option from the drop-down list.
- Click Payment Methods in the menu panel.
- Scroll down. Click Razorpay and enter your test mode
[KEY_ID]
and[KEY_SECRET]
. - Select Yes for the Enabled option.
- 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.
You can install the extension through two ways:
-
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.
-
Go to your installation root directory of Magento and execute the following command:
composer require razorpay/magentobin/magento module:enable Razorpay_Magento -
You can check if the installation was successful by executing the following command in the Magento root directory.
bin/magento module:statusHandy Tips
You should see
Razorpay_Magento
in the status. It might appear on the disabled modules list. -
Enable and deploy the Razorpay module using commands:
bin/magento module:enable Razorpay_Magentobin/magento setup:di:compilebin/magento setup:upgradebin/magento cache:flushbin/magento setup:static-content:deploy
Upgrade Magento Extension
If you are an existing extension user, you can
to the latest version using the composer.To configure your Magento store for Razorpay:
- Log in to your .
- Choose Stores on the Admin sidebar to the left. Now go to Settings → Configuration.
- In the Configuration page, click on Sales on the left and choose Payment Methods.
- In the Payment Methods page, navigate to Razorpay.
- Enter your test mode [KEY_ID] and [KEY_SECRET]. These can be .
- Select Yes for the option Enabled.
- 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 Razorpay Dashboard.
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 Razorpay Dashboard:
- Log in to the Dashboard.
- Navigate to Settings → Webhooks.
- Click + Add New Webhook.
- 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.
-
- 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:
Cancel Pending Orders
It will cancel the order created by Razorpay according to the timeout saved in the configuration if Cancel Pending Order is enabled.
Update Order to Processing
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
After the integration, a Pay button will appear on your web page/app. You need to click the button and make a test transaction to ensure the integration works as expected. You can start accepting actual payments from your customers once the test is successful.

You can make test payments using one of the payment methods configured at the Checkout.
- No money is deducted from the customer's account as this is a simulated transaction.
- Ensure you have entered the API keys generated in the test mode in the Checkout code.
You can select any of the listed banks. After choosing a bank, Razorpay will redirect to a mock page where you can make the payment a success
or a failure
. Since it is the test mode, we will not redirect you to the bank login portals.
You can enter one of the following UPI IDs:
success@razorpay
: To make the payment successful.failure@razorpay
: To fail the payment.
Handy Tips
You can use Test Mode to test UPI payments, and Live Mode for UPI Intent and QR payments.
You can select any of the listed wallets. After choosing a wallet, Razorpay will redirect to a mock page where you can make the payment a success
or a failure
. Since it is the test mode, we will not redirect you to the wallet login portals.
You can use one of the test cards to make transactions in the test mode. Use any valid expiration date in the future and any random CVV to create a successful payment.
Follow these steps before taking the integration live:
You can perform an end-to-end simulation of funds flow in the Test Mode. Once confident that the integration is working as expected, switch to the Live Mode and start accepting payments from customers.
Watch Out!
Ensure you are switching your test API keys with API keys generated in Live Mode.
To generate API Keys in Live Mode on your Dashboard:
- Log in to the Dashboard and switch to Live Mode on the menu.
- Navigate to Account & Settings → API Keys → Generate Key to generate the API Key for Live Mode.
- Download the keys and save them securely.
- Replace the Test API Key with the Live Key in the Checkout code and start accepting actual payments.
After payment is authorized
, you need to capture it to settle the amount to your bank account as per the settlement schedule. Payments that are not captured are auto-refunded after a fixed time.
Watch Out
- You should deliver the products or services to your customers only after the payment is captured. Razorpay automatically refunds all the uncaptured payments.
- You can track the payment status using our or webhooks.
Authorized payments can be automatically captured. You can auto-capture all payments
on the Dashboard. Know more about .Watch Out!
Payment capture settings work only if you have integrated with Orders API on your server side. Know more about the
.Is this integration guide useful?