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
Integration Steps for Magento 1.x Extension
Step 1: Download and Install via Repository
Step 1: Download and Install via Repository
Follow the steps given below to download and install Magento 1.x Extension.Once installed, navigate to Configuration and then to Payment Gateways and configure the extension to suit your needs.
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:- Install via Magento Connect
- Install Without Magento Connect
- Go to Magento Connect Manager.
- Go to
Direct package file upload. - Click
Choose Fileand select the TGZ file from Step 1. - Click
upload.
Step 2: Configure Magento Store 1.x
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
Integration Steps for Magento 2.x Extension
Step 1: Download and Install Extension
Step 1: Download and Install Extension
You can install the extension through two ways:
- Install Using Composer
- Install Without Composer
- 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
Upgrade Magento ExtensionIf you are an existing extension user, you can upgrade to the latest version using the composer.
Step 2: Configure Magento Store 2.x
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
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.To set up webhooks in 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.
- 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
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 events
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: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
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.Following are all the payment modes that the customer can use to complete the payment on the Checkout. Some of them are available by default, while others may require approval from us. Raise a request from the Dashboard to enable such payment methods.
You can make test payments using one of the payment methods configured at the Checkout.
FPX
FPX
You can select any of the listed banks. After choosing a bank, Razorpay Curlec will redirect to a mock page where you can make the payment a
success or a failure. Since this is Test Mode, we will not redirect you to the bank login portals.Wallet
Wallet
You can select any of the listed wallets. After choosing a wallet, you will be redirected to a mock page where you can make the payment
success or a failure. Since this is Test Mode, we will not redirect you to the wallet login portals.Cards
Cards
You can use one of the following test cards to test transactions for your integration in Test Mode.
Check the following lists:
Verify Payment Status
Verify Payment Status
You can track the payment status from the Dashboard or by polling APIs.
- Verify Payment Status From Dashboard
- Poll 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:1 Accept Live Payments
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.To generate API Keys in Live Mode on your Razorpay Dashboard:
- Log in to the Razorpay 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.
2 Payment Capture
2 Payment Capture
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.- Auto-capture Payments (Recommended)
- Manually Capture Payments
Authorized payments can be automatically captured. You can auto-capture all payments using global settings on the Razorpay Dashboard. Know more about capture settings for payments.