- Razorpay Subscription Plugin has a very quick and customer-friendly integration.
- There is no need to create Plans or Subscriptions using the Razorpay Dashboard or Razorpay APIs. All this can be done easily from your Magento Dashboard.
- Customers are not redirected from your website to make payments.
- You can accept recurring payments using Razorpay Subscription Plugin on your Magento website itself via Credit Card, Debit Card, Netbanking and UPI payment methods.
Razorpay Subscriptions Plugin for Magento
Accept recurring payments on your Magento site using the Razorpay Subscription for Magento plugin.
You can now accept recurring payments on your Magento site using the Razorpay Subscriptions for Magento. This plugin is built on the Razorpay Subscriptions product and offers seamless integration, allowing you to create and sell subscription services on your website.
Click the below button to download the Magento plugin.
You must have the following installed for the plugin to work:
- Sign up for a Razorpay Account.
- Generate API Keys from the Razorpay Dashboard.
Watch this video to learn how to generate API keys from the Razorpay Dashboard.
To start accepting subscription payments using the plugin:
On Your Magento Site:
- Install the Razorpay Subscriptions for Magento Plugin.
- Configure Magento Store.
- Create a Plan for a Subscription Product.
- Enable Subscriptions for your Product.
- Test it out - Sign up for a Subscription.
On the Razorpay Dashboard:
There are two methods to install the Razorpay Subscription for Magento plugin:
- Install with Composer
- Manual without Composer
You can 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.
To install the Razorpay module using the Composer Package Manager:
Go to your installation root directory of Magento and execute the following command.Copy
composer require razorpay/subscriptions-magento-plugin bin/magento module:enable Razorpay_Subscription
Run the following command to check the installation status.Copy
To install the Razorpay Subscriptions without the Composer Package Manager:
- Download the
code.zipfile from the latest release and extract the zip.
- Place the
codefolder in your
appfolder. If you are updating the Razorpay Subscriptions, replace or overwrite the existing
- Enable and deploy the Razorpay module using the following commands.
bin/magento module:enable Razorpay_Subscription bin/magento setup:upgrade
To configure your Magento store for Razorpay:
Log into your Magento store.
Click Stores in the left menu and navigate to Settings → Configuration.
Expand Sales in the left menu and click Payment Methods.
Go to Razorpay in the Payment Methods page.
Enter your test mode [KEY_ID] and [KEY_SECRET]. These can be generated from your Dashboard.
Select the webhook events from the Webhook Events drop-down list to enable webhook notifications.
Select Yes from the Enabled drop-down list to enable the option to sell the Subscriptions.
Click Save Config.
This activates your account in the Test Mode. You can use this account to make a few test payments to ensure a successful workflow.
To create a plan for a Subscription product:
Log into your Magento store.
Navigate to Razorpay Subscription → Manage Plans.
Click Add New Plan.
Enter the all the required details.
Click Save Plan.
You can enable or disable a plan only after it is created.
To configure your product for Subscription in the Magento store:
Log into your Magento store.
Navigate to Catalog → Products.
Select any product you want to enable Subscription and go to Subscription By Razorpay section.
Enable the Subscription on the product level. You can select the Subscription mode. Following are the options available.
Subscription Only: Customers will get an option of only a Subscription with a respective plan, and they will be unable to buy a product for one time.
With Subscription: Customers will have both the option for buying a product once for all and a Subscription.
Click Save to save the product.
To buy a product on a Subscription basis:
- Go to your Magento website and select the product which you have enabled for Subscription.
- Select the Subscribe to this product option and select the Subscription frequency from the Select Frequency drop-down list.
- Click Add to Cart to proceed.
- After the product is added to your cart, the Subscription details will be shown in the cart and the mini cart.
- Click Proceed to Checkout to proceed with the checkout.
You can set up a webhook from your Razorpay Dashboard and configure separate URLs for live and test mode.
For details of available events and sample payloads, refer to the Webhook Events section.
Watch this video to see how to set up a webhook.
To set up webhooks:
Log into the Razorpay Dashboard and navigate to Settings → Webhooks.
Click the + Add New Webhook button.
In the Webhook Setup pop-up page:
Enter the URL where you want to receive the webhook payload when an event is triggered. We recommended using an HTTPS URL.
You can set up to 10 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.
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.
- 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.
- The webhoook secret does not need to be the merchant secret key provided by Razorpay.
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.
Select the required events from the list of Active Events.
Click Create Webhook. After you set a webhook, it appears on the list of webhooks.
You can click Edit to make changes to the webhooks.