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.

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

  • Sign up for a Razorpay Account.
  • Generate API Keys from the Dashboard.

Watch this video to know how to generate API keys from the Razorpay Dashboard.

  • Navigate to Subscriptions and click Next and Get Started.
  • Razorpay Subscriptions is based on the existing Razorpay process. If you are new to Razorpay, we recommend you to understand this flow before you read further.

To start accepting subscription payments using the plugin:

On Your Magento Site:

  1. .
  2. .
  3. .
  4. .
  5. .

On the Razorpay Dashboard:

  1. .

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:

  1. Go to your installation root directory of Magento and execute the following command.

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

    bin/magento module:status

To install the Razorpay Subscriptions without the Composer Package Manager:

  1. Download the code.zip file from the 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.
bin/magento module:enable Razorpay_Subscription
bin/magento setup:upgrade

To configure your Magento store for Razorpay:

  1. Log in to your .
  2. Click Stores in the left menu and navigate to SettingsConfiguration.
  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.

To create a plan for a Subscription product:

  1. Log in to your .
  2. Navigate to Razorpay SubscriptionManage 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.

To configure your product for Subscription in the Magento store:

  1. Log in to your .
  2. Navigate to CatalogProducts.
  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.

To buy a product on a Subscription basis:

  1. Go to your 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.

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

.

Watch this video to see how to set up a webhook.

To set up webhooks:

  1. Log in to the

    and navigate to Accounts & Settings.

  2. Click Webhooks under Website and app settings.

  3. Click the + Add New Webhook button.

    Add a new webhooks button on the Razorpay dashboard
  4. 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 .
    • 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

      .

      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 webhook 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 related notifications like failures, deactivation and so on.

    • Select the required events from the list of Active Events.

    List of active webhook events on dashboard

  5. Click Create Webhook. After you set a webhook, it appears on the list of webhooks.

    List of webhooks on dashboard
  6. You can select the webhook and click Edit to make more changes.


Was this page helpful?