Skip to main content
Click the below button to download the Magento plugin. Magento

Advantages

  • 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.

Plugin Dependencies

You must have the following installed for the plugin to work:

Platform/Plugin/Language | Version

Magento | 2.3 or higher

Razorpay Magento PG plugin | 3.5 or higher

Razorpay Magento Subscriptions Plugin | 1.0.0

PHP | 5.6.0 or higher

php-curl | N/A

Prerequisites

  • Sign up for a Razorpay Account.
  • Generate API Keys from the Dashboard.
Watch this video to know how to generate API keys from the Dashboard.
  • Navigate to Razorpay DashboardSubscriptions and click Next and Get Started.
  • Razorpay Subscriptions is based on the existing Razorpay payment flow process. If you are new to Razorpay, we recommend you to understand this flow before you read further.

Integration Steps

To start accepting subscription payments using the plugin: On Your Magento Site: On the Razorpay Dashboard:
  1. Enable Webhooks.

Install the Razorpay Subscriptions for Magento Plugin

There are two methods to install the Razorpay Subscription for Magento plugin:
  • Install with Composer
  • Manual without Composer

Install the Razorpay Module with 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:
  1. Go to your installation root directory of Magento and execute the following command.
    Deploy Commands
  2. Run the following command to check the installation status.
    Installation Status Commands

Install the Razorpay Module without Composer

To install the Razorpay Subscriptions without the Composer Package Manager:
1

Step 1

Download the code.zip file from the latest release and extract the zip.
2

Step 2

Place the code folder in your app folder. If you are updating the Razorpay Subscriptions, replace or overwrite the existing code folder.
3

Step 3

Enable and deploy the Razorpay module using the following commands.
Deploy Commands

Configure Magento Store

To configure your Magento store for Razorpay:
1

Step 1

Log in to your Magento store.
2

Step 2

Click Stores in the left menu and navigate to SettingsConfiguration.
3

Step 3

Expand Sales in the left menu and click Payment Methods.
4

Step 4

Go to Razorpay in the Payment Methods page.
5

Step 5

Enter your test mode [KEY_ID] and [KEY_SECRET]. These can be generated from your Dashboard.
6

Step 6

Select the webhook events from the Webhook Events drop-down list to enable webhook notifications.
7

Step 7

Select Yes from the Enabled drop-down list to enable the option to sell the Subscriptions.
8

Step 8

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.

Create a Plan for Subscription Product.

To create a plan for a Subscription product:
1

Step 1

Log in to your Magento store.
2

Step 2

Navigate to Razorpay SubscriptionManage Plans.
3

Step 3

Click Add New Plan.
4

Step 4

Enter the all the required details.
5

Step 5

Click Save Plan.
Watch Out!You can enable or disable a plan only after it is created.

Enable Subscriptions for your Product

To configure your product for Subscription in the Magento store:
1

Step 1

Log in to your Magento store.
2

Step 2

Navigate to CatalogProducts.
3

Step 3

Select any product you want to enable Subscription and go to Subscription By Razorpay section.
4

Step 4

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.
5

Step 5

Click Save to save the product.

Buy a Product on a Subscription Basis

To buy a product on a Subscription basis:
1

Step 1

Go to your Magento website and select the product which you have enabled for Subscription.
2

Step 2

Select the Subscribe to this product option and select the Subscription frequency from the Select Frequency drop-down list.
3

Step 3

Click Add to Cart to proceed.
4

Step 4

After the product is added to your cart, the Subscription details will be shown in the cart and the mini cart.
5

Step 5

Click Proceed to Checkout to proceed with the checkout.

Enable Webhooks

You can set up a webhook from the Dashboard and configure separate URLs for live and test mode.
Handy TipsFor details of available events and sample payloads, refer to the Webhook Events section.

Setup Webhooks

Watch this video to see how to set up a webhook. To set up webhooks:
1

Step 1

Log in to the Dashboard and navigate to Accounts & Settings.
2

Step 2

Click Webhooks under Website and app settings.
3

Step 3

Click the + Add New Webhook button.
  1. In the Webhook Setup pop-up page:
    • Enter the URL where you want to receive the webhook payload when an event is triggered. We recommend using an HTTPS URL.
Handy Tips
  • You can set up to 30 URLs to receive Webhook notifications. Webhooks can only be delivered to public URLs.
  • If your URL contains razorpay as a domain, you will not be able to add the URL and will receive an error.
  • 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.
Handy Tips
  • When setting up the webhook, specify a secret. Use this secret to validate that the webhook is from Razorpay. Entering the secret is optional but recommended. The secret should never be exposed publicly.
  • The webhook secret does not need to be the Razorpay API key secret.
    • 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 related notifications like failures, deactivation and so on.
    • Select the required events from the list of Active Events.
  1. Click Create Webhook. After you set up a webhook, it appears on the list of webhooks.
  2. You can select the webhook and click Edit to make more changes.