- 1. Build Integration: Install the Magento plugin.
- 2. Test Integration: Test the integration by making a test payment.
- 3. Go-Live Checklist: Check the go-live checklist.
1. Build Integration
Follow the steps given below to integrate Razorpay Payment Gateway with your Magento 1.x and 2.x Extensions.Integration Steps for Magento 1.x Extension
Step 1: Download and Install via Repository Follow the steps given below to download and install Magento 1.x Extension.Download Repository
- Download the
Razorpay-1.2.1.tgzfile from the latest release. - If you have Onepage Checkout (IWD or Fire Checkout), download 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.
Install Repository
You can install the repository in two ways:- Go to Magento Connect Manager.
-
Go to
Direct package file upload. -
Click
Choose Fileand select the TGZ file from Step 1. -
Click
upload. - Unzip and open the downloaded folder.
- Copy the app folder.
- Paste and merge it into the Magento root folder.
- Copy the js folder.
- Paste and merge it into the Magento root folder.
Step 2: Configure Magento Store 1.x
To configure your Magento store for Razorpay:- Log in to your Magento store.
- 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 TipsIn test mode, no real money is deducted from your account.
Integration Steps for Magento 2.x Extension
Step 1: Download and Install Extension 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:
Command
-
You can check if the installation was successful by executing the following command in the Magento root directory.
Command
Handy TipsYou should see
Razorpay_Magento in the status. It might appear on the disabled modules list.-
Enable and deploy the Razorpay module using commands:
Command
-
Download the
code.zipfile from the latest release. Extract the zip. -
Place the
codefolder from Step 1 in yourappfolder. If you’re performing an update, replace/overwrite the existingcodefolder. -
Enable and deploy the Razorpay module using commands:
Command
-
Install Magento cron jobs using the command:
Command
-
Enter the following command to compile the dependency code:
Command
-
Enter the following command to upgrade the Razorpay Magento module from the Magento installation folder:
Command
- On the Magento Admin Dashboard, open Razorpay payment method settings and click Save Config.
Step 2: Configure Magento Store 2.x
To configure your Magento store for Razorpay:- Log in to your Magento store.
- 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 generated from the Razorpay Dashboard.
- 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 TipsIn test mode, no real money is deducted from your account.
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 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 configure webhooks manually.
To set up webhooks in the Razorpay Dashboard:
- Log in to the Razorpay Dashboard.
- Navigate to Accounts & Settings → Webhooks.
- Click + Add New Webhook.
- In the Webhook Setup modal:
- Paste the URL copied from the Magento site.
Handy TipsWebhooks 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 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 webhooks validation.
- In the Alert Email field, enter the email address to which notifications must be sent in case of webhook failure.
- Select only the
order.paidevent from the list of Active Events.
- Click Create Webhook.
Handy TipsIf the notification says Razorpay table is not set up correctly, please contact our Support team.
Step 4: Set Up Cron With Magento
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 eventspayment.authorized and order.paid and updates pending order to processing.
Install Magento cron jobs using the command:
Command
2. Test Integration
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.
Supported Payment Methods
After the integration is complete, a Pay button appears on your webpage/app. Click the button and make a test transaction to ensure the integration is working as expected. You can start accepting actual payments from your customers once the test transaction is successful.UPI
You can enter one of the following UPI IDs:success@razorpay: To make the payment successful.failure@razorpay: To fail the payment.
Handy TipsYou can use Test Mode to test UPI payments, and Live Mode for UPI Intent and QR payments.
Cards
You can use the following test cards to test transactions for your integration in Test Mode.Domestic Cards
Use the following test cards for Indian payments:Network | Card Number | CVV & Expiry Date
Visa | 4100 2800 0000 1007 | Use a random CVV and any future date ^^^^^
Mastercard | 5500 6700 0000 1002 |
RuPay | 6527 6589 0000 1005 |
Diners | 3608 280009 1007 |
Amex | 3402 560004 01007 |Error Scenarios
Use these test cards to simulate payment errors. See the complete list of error test cards with detailed scenarios. Check the following lists:International Cards
Use the following test cards to test international payments. Use any valid expiration date in the future in the MM/YY format and any random CVV to create a successful payment.Card Network | Card Number | CVV & Expiry Date
Mastercard | 5555 5555 5555 4444 5105 1051 0510 5100 5104 0600 0000 0008 | Use a random CVV and any future date ^^
Visa | 4012 8888 8888 1881 | Check the list of supported card networks.Wallet
You can select any of the listed wallets. After choosing a wallet, Razorpay will redirect to a mock page where you can make the paymentsuccess or a failure. Since this is Test Mode, we will not redirect you to the wallet login portals.
Check the list of supported wallets.
Verify Payment Status
You can track the payment status from the Dashboard or by polling APIs.- Log in to the Razorpay Dashboard and navigate to Transactions → Payments.
- Check if a
payment_IDhas been generated and note the status. In case of a successful payment, the status is marked ascaptured.
3. Go-live Checklist
Follow these steps before taking the integration live:3.1 Accept Live Payments
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.3.2 Payment Capture
After payment isauthorized, 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.