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.

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.

Prerequisites🔗

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

  • Navigate to Razorpay Dashboard → Subscriptions 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:

  1. Install the Razorpay Subscriptions for Magento Plugin.
  2. Configure Magento Store.
  3. Create a Plan for a Subscription Product.
  4. Enable Subscriptions for your Product.
  5. Test it out - Sign up for a Subscription.

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.

    Copycomposer require razorpay/subscriptions-magento-plugin bin/magento module:enable Razorpay_Subscription
  2. Run the following command to check the installation status.

    Copybin/magento module:status

Install the Razorpay Module without Composer🔗

To install the Razorpay Subscriptions without the Composer Package Manager:

  1. Download the code.zip file from the latest release and extract the zip.
  2. Place the code folder in your app folder. If you are updating the Razorpay Subscriptions, replace or overwrite the existing code folder.
  3. Enable and deploy the Razorpay module using the following commands.
Copybin/magento module:enable Razorpay_Subscription bin/magento setup:upgrade

Configure Magento Store🔗

To configure your Magento store for Razorpay:

  1. Log into your Magento store.

  2. Click Stores in the left menu and navigate to Settings → Configuration.

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

  4. Go to Razorpay in the Payment Methods page.

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

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

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

  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. Log into your Magento store.

  2. Navigate to Razorpay Subscription → Manage Plans.

  3. Click Add New Plan.

  4. Enter the all the required details.

  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. Log into your Magento store.

  2. Navigate to Catalog → Products.

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

  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. Click Save to save the product.

Buy a Product on a Subscription Basis🔗

To buy a product on a Subscription basis:

  1. Go to your Magento website and select the product which you have enabled for Subscription.
  2. Select the Subscribe to this product option and select the Subscription frequency from the Select Frequency drop-down list.
  3. Click Add to Cart to proceed.
  4. After the product is added to your cart, the Subscription details will be shown in the cart and the mini cart.
  5. Click Proceed to Checkout to proceed with the checkout.

Enable Webhooks🔗

You can set up a webhook from your Razorpay Dashboard and configure separate URLs for live and test mode. Handy Tips
For 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. Log into the Razorpay Dashboard and navigate to Settings → Webhooks.

  2. Click the + Add New Webhook button.

  3. In the Webhook Setup pop-up page:

    1. Enter the URL where you want to receive the webhook payload when an event is triggered. We recommended using an HTTPS URL. Handy Tips
      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.
    2. 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, 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.
  4. 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.
  5. 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.

    ×