> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay-60c89f9a-mintlify-audit-missing-sections-1778528421.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Razorpay Subscriptions Plugin for Magento

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

[Magento](https://github.com/razorpay/subscriptions-magento-plugin/releases)

## 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](https://github.com/razorpay/razorpay-magento) | 3.5 or higher

## [Razorpay Magento Subscriptions Plugin](https://github.com/razorpay/subscriptions-magento-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 Dashboard** → **Subscriptions** and click **Next** and **Get Started**.
* Razorpay Subscriptions is based on the existing Razorpay [payment flow](/payments/payment-gateway/how-it-works) 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:

<Steps>
  <Step title="Step 1">
    [Install the Razorpay Subscriptions for Magento Plugin](/payments/subscriptions/plugins/magento#install-the-razorpay-subscriptions-for-magento-plugin).
  </Step>

  <Step title="Step 2">
    [Configure Magento Store](/payments/subscriptions/plugins/magento#configure-magento-store).
  </Step>

  <Step title="Step 3">
    [Create a Plan for a Subscription Product](/payments/subscriptions/plugins/magento#create-a-plan-for-subscription-product).
  </Step>

  <Step title="Step 4">
    [Enable Subscriptions for your Product](/payments/subscriptions/plugins/magento#configure-your-product-for-subscriptions).
  </Step>

  <Step title="Step 5">
    [Test it out - Sign up for a Subscription](/payments/subscriptions/plugins/magento/test-it-out).
  </Step>
</Steps>

On the Razorpay Dashboard:

1. [Enable Webhooks](/payments/subscriptions/plugins/magento#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.

   ```php: Deploy Commands theme={null}
   composer require razorpay/subscriptions-magento-plugin
   bin/magento module:enable Razorpay_Subscription
   ```

2. Run the following command to check the installation status.

   ```php: Installation Status Commands theme={null}
   bin/magento module:status
   ```

#### Install the Razorpay Module without Composer

To install the Razorpay Subscriptions without the Composer Package Manager:

<Steps>
  <Step title="Step 1">
    Download the `code.zip` file from the [latest release](https://github.com/razorpay/subscriptions-magento-plugin/releases) and extract the zip.
  </Step>

  <Step title="Step 2">
    Place the `code` folder in your `app` folder. If you are updating the Razorpay Subscriptions, replace or overwrite the existing `code` folder.
  </Step>

  <Step title="Step 3">
    Enable and deploy the Razorpay module using the following commands.
  </Step>
</Steps>

```php: Deploy Commands theme={null}
bin/magento module:enable Razorpay_Subscription
bin/magento setup:upgrade
```

### Configure Magento Store

To configure your Magento store for Razorpay:

<Steps>
  <Step title="Step 1">
    Log in to your [Magento store](https://business.adobe.com/products/magento/magento-commerce.html/).
  </Step>

  <Step title="Step 2">
    Click **Stores** in the left menu and navigate to **Settings** → **Configuration**.
  </Step>

  <Step title="Step 3">
    Expand **Sales** in the left menu and click **Payment Methods**.
  </Step>

  <Step title="Step 4">
    Go to **Razorpay** in the **Payment Methods** page.
  </Step>

  <Step title="Step 5">
    Enter your test mode \[KEY\_ID] and \[KEY\_SECRET]. These can be generated from your Dashboard.
  </Step>

  <Step title="Step 6">
    Select the webhook events from the **Webhook Events** drop-down list to enable webhook notifications.
  </Step>

  <Step title="Step 7">
    Select **Yes** from the **Enabled** drop-down list to enable the option to sell the Subscriptions.
  </Step>

  <Step title="Step 8">
    Click **Save Config**.
  </Step>
</Steps>

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:

<Steps>
  <Step title="Step 1">
    Log in to your [Magento store](https://business.adobe.com/products/magento/magento-commerce.html/).
  </Step>

  <Step title="Step 2">
    Navigate to **Razorpay Subscription** → **Manage Plans**.
  </Step>

  <Step title="Step 3">
    Click **Add New Plan**.
  </Step>

  <Step title="Step 4">
    Enter the all the required details.
  </Step>

  <Step title="Step 5">
    Click **Save Plan**.
  </Step>
</Steps>

<Warning>
  **Watch Out!**

  You can enable or disable a plan only after it is created.
</Warning>

### Enable Subscriptions for your Product

To configure your product for Subscription in the Magento store:

<Steps>
  <Step title="Step 1">
    Log in to your [Magento store](https://business.adobe.com/products/magento/magento-commerce.html/).
  </Step>

  <Step title="Step 2">
    Navigate to **Catalog** → **Products**.
  </Step>

  <Step title="Step 3">
    Select any product you want to enable Subscription and go to **Subscription By Razorpay** section.
  </Step>

  <Step title="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.
  </Step>

  <Step title="Step 5">
    Click **Save** to save the product.
  </Step>
</Steps>

#### Buy a Product on a Subscription Basis

To buy a product on a Subscription basis:

<Steps>
  <Step title="Step 1">
    Go to your [Magento website](https://business.adobe.com/products/magento/magento-commerce.html/) and select the product which you have enabled for Subscription.
  </Step>

  <Step title="Step 2">
    Select the **Subscribe to this product** option and select the Subscription frequency from the **Select Frequency** drop-down list.
  </Step>

  <Step title="Step 3">
    Click **Add to Cart** to proceed.
  </Step>

  <Step title="Step 4">
    After the product is added to your cart, the Subscription details will be shown in the cart and the mini cart.
  </Step>

  <Step title="Step 5">
    Click **Proceed to Checkout** to proceed with the checkout.
  </Step>
</Steps>

## Enable Webhooks

You can set up a webhook from the Dashboard and configure separate URLs for live and test mode.

<Info>
  **Handy Tips**

  For details of available events and sample payloads, refer to the [Webhook Events section](/payments/payment-gateway/ecommerce-plugins/woocommerce/troubleshooting-faqs).
</Info>

### Setup Webhooks

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

To set up webhooks:

<Steps>
  <Step title="Step 1">
    Log in to the Dashboard and navigate to **Accounts & Settings**.
  </Step>

  <Step title="Step 2">
    Click **Webhooks** under **Website and app settings**.
  </Step>

  <Step title="Step 3">
    Click the **+ Add New Webhook** button.
  </Step>
</Steps>

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.

<Info>
  **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](/webhooks/validate-test#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](/webhooks/validate-test).
</Info>

<Info>
  **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**.

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

  6. You can select the webhook and click **Edit** to make more changes.
</Info>
