Magento 2 Recurring Payment Subscription: This module provides the functionality to manage subscription & recurring payments for the products of the admin.

Apart from that, it allows the customers to make a subscription for the allowed products on a daily, weekly, Monthly & Yearly basis.

Check the plugin’s configuration part – 

Recurring Payment for Magento 2 (Adobe Commerce) Features

  • The merchant can enable/disable the Recurring Payment.
  • The admin can manage PayPal Recurring payments.
  • Also, the owner can view/unsubscribe customer's subscriptions.
  • Moreover, customers can view/unsubscribe to their subscriptions.
  • Additionally, it supports online recurring payments with PayPal.
  • Additionally, this module supports online Stripe recurring payments.
  • Even it supports offline recurring payments too
  • Further merchants can add more than one subscription product.
  • As well as the owner can select the subscription price scope as global or website-wise.
  • Furthermore, the admin sets the subscription amount & subscription initial fee product-wise.
  • This extension supports simple, configurable, virtual, and downloadable product types.
  • Then, the merchant can manage the duration type.

Magento 2 Recurring Payment Installation

Now, follow the below steps for installing the Magento 2 PayPal Recurring Payment Extension –

Step 1:

first of all, Unzip the respective extension zip and then move the “app” folder (inside “src” folder) into the Magento (Adobe Commerce) root directory on the server.

magento 2 recurring payments installation

Step 2:

After that, run the below-mentioned commands in the Magento 2 root directory via terminal.

First command –composer require stripe/stripe-php:~7.40

Command

Second Command -composer require paypal/rest-api-sdk-php:*

command

Third Command -php bin/magento setup:upgrade

command2

Fourth Command – php bin/magento setup:di:compile

command3

Fifth Command – php bin/magento setup:static-content:deploy

command4

Step 3:

lastly, flush the cache and re-index all by navigating through System->Cache management.

magento 2 recurring payments flush cache

How to Get PayPal & Stripe Credentials?

PayPal Credentials

Now, Log in to PayPal business account and navigate through “Payment Setup”->

On your website”-> “continue” button.

screencapture-paypal-activation

Then, tap on “Option A” to select a third-party e-commerce solution where the PayPal payment process is built-in.

after that, in Option A tap on the “Get your API Credentials” link.

paypal-activation-businessSetup2-2

Post this, click on the “Manage API Credentials” button to see API Credentials.

businessmanage-credentials-apiAccess

Now here, you can see your API Username, API Password, and Signature.

API-Signature-1

Stripe Credentials

To get the API Keys you can use the link- https://dashboard.stripe.com/login.

You have to Log in/Sign up your account and you will get your API Keys.

As you can see in the following screenshot the keys are there for the Test and live environments – Publishable Key and the Secret Key.

stripe acc

Setting Up IPN Notifications on PayPal

Setting Up IPN Notifications on PayPal

The following method defines how to specify and activate the URL for your IPN listener in your PayPal profile.

Your listener must be located at the URL that you specify in the profile.

Before you activate your listener on PayPal, you should test the listener using the IPN simulator in the sandbox.

The steps to set up your listener for Sandbox testing and to set up your listener for live operation on PayPal are the same.

The only difference is that you log into the sandbox to set up your listener for Sandbox testing and you log into PayPal to set up your listener for live operation.

Note: 

Sandbox testing goes beyond simply using the IPN simulator. The IPN simulator only sends IPN messages to a listener; it does not perform the complete operation; for example, it does not complete a transaction.

Sandbox testing involves performing the same actions in the sandbox as you expect to be performed when the listener goes live.

Post that you log in, follow these instructions to set up your listener:

  1. Log in to your PayPal business account at www.paypal.com.
  2. Click the settings icon at the top of your PayPal account page and then click Account Settings.
  3. On the Notifications page, click the Update link for the Instant payment notifications item.
  4. Click Choose IPN Settings to specify your listener’s URL and activate the listener. The following page opens:
  5. Specify the URL for your listener in the Notification URL field.
  6. Click Receive IPN messages (Enabled) to enable your listener.
  7. Click Save. The following page opens:

You can return to the Instant Payment Notification page to modify your notification URL, disable your listener, or turn off IPN.

Note: 

IPN Url to be set: [magento-url]/recurring/paypal/notify

The IPN message is always sent to your notification URL unless you have disabled the preference to receive IPN messages.

Set Webhook in Stripe for Webkul Recurring Payments

In web development, a webhook is a method of altering the behavior of a web page, or web application, with custom callbacks.

Webhooks are basically user-defined HTTP callbacks that are triggered by specific events.

Now for setting up the Webhook in Stripe, follow the steps listed below-

Step1: Login to Stripe Account

webkul-magento2-recurring-subscription-login

Step 2 –

  • ‘View Test Data'(as per your need), and
  • Tick on ‘Developers’ thence
  • Go on ‘Webhook’. 
webkul-magento2-recurring-subscription-webhook

Step 3 –

Here, Add Endpoint.

webkul-magento2-recurring-subscription-add-point

Step 4:

Fill the details as shown in the screenshot and save the details.

webkul-magento2-recurring-subscription-step-4

Step 5:

Go to the ‘Send Test Webhook’ to check whether the given URL is working or not.

Magento2 Recurring Payment Subscription - Dashboard – Whosthechef – Stripe Test

Now you can easily send a test event to a webhook endpoint, by selecting the specific event type & by clicking on the Send test Webhook button.

Magento2 Recurring Payment Subscription - Dashboard – Whosthechef – Stripe Test

Magento 2 Recurring Payment Configuration – Admin

Magento2 Recurring Payment Subscription - module-configuration

Magento 2 Recurring Payment and Subscription

After the successful installation of the extension, the admin will configure the module settings. To do so, the admin will navigate through Stores->Configuration->Webkul->Subscription Configuration.

Here, the admin will be able to –

  • Enable the functionality by selecting a Yes option else to select a NO for Disabling the functionality.
  • Select the Subscription Price Scope –  Select the scope for using the extension as  Global or Website wise.
  • Enable Discount on Subscriptions:  Select a Yes to apply discounts on subscriptions, it is valid only on the first order else select a No.
  • Allow Multiple Subscriptions in Cart: Select a Yes multiple subscription products can be added to the cart at a time. If their “Start Date and Duration types” are the same.
  • Allowed Payment Methods to Buy Subscription:  Here, choose the payment methods that will be available to customers for buying the subscription product.

Configuration – Recurring PayPal Payment Method

Thereafter, the admin needs to navigate through Stores->Configuration->Sales->Payment Methods->Webkul Recurring PayPal Express Checkout Payment Method.

Here, the admin will configure the settings for the payment method as shown below in the snapshot.

Magento2 Recurring Payment Subscription_paypal_payment_configuration-1

Here, the admin will –

  • Enable this solution for making it available for use at the frontend.
  • Sandbox Mode

    Select Yes to enable the testing mode else select No to make use of the Live mode.
  • Title

    Set the Title for the Payment method which is visible to the customers at the checkout page.
  • Merchant PayPal ID

    Enter your Merchant PayPal Id within the space provided.
  • PayPal API User Name

    Enter your PayPal User Name.
  • PayPal API Password

    Enter your PayPal password.
  • PayPal API Signature

    Enter your PayPal Signature
  • Payment Form Applicable Countries

    Select All to allow payment from all the countries else selects Specific Countries.
  • Payment From Specific Countries

    Select the specific countries from where you want to receive the payments.
  • Sort Order

    Set the sort order for this payment method at the checkout time.

Configuration – Recurring Stripe Payment Method

The admin will be able to configure recurring stripe payment method by navigating through Stores->Configuration->Sales->Payment Methods->Webkul Recurring Stripe Payment Method likewise shown in the image below:

Magento2 Recurring Payment Subscription_stripe_payment_configuration-1

Here, the admin will-

Enable this Solution: Select Yes to enable this payment method else to select No to disable this payment method.

Title: Set the Title for the Payment method which is visible to the customers at the checkout page.

Sandbox Mode: Select Yes to enable the testing mode else select No to make use of the Live mode.

API Publishable Key: Enter your Stripe API publishable key.

API Secret Key: Enter your Stripe API secret key.

Set Name Display on Form: Set the Name for the Payment method which is visible to the customers at the form while entering the card details.

Payment from Applicable Countries: Select the specific countries from where you want to receive the payments

Minimum Order Total: Here, the admin needs to enter the minimum amount allowed by stripe.

Sort Order: Set the sort order for this payment method at the checkout time.

Recurring Payments – Admin

The admin will have the Recurring section in the admin backend panel thenceforward the successful installation of the Magento2 Recurring Payment Subscription extension. The merchant should have CRM Extension to retain customers.

Magento2 Recurring Payment Subscription - recurring payments admin management

Here the admin has two sub-sections to manage:

  • Manage Duration Type Under here, the admin will be able to create the subscription duration.



    To create a new duration type, tap the Add Duration Type button. You can create the duration type as – daily, weekly, Monthly & Yearly basis.

    Also, after you have created a subscription duration, no other same duration type can again be created. If you try creating one, you will get an error message as shown below in the snapshot.
  • Manage Subscriptions

Under this section, the admin will find all the recurring subscriptions listed.

Magento2 Recurring Payment Subscription - all-subscription

To view a subscription detail, tap the View link and you will be able to see the subscription information for that particular subscription.

Magento2 Recurring Payment Subscription - admin-subscription

Under the Orders section, the admin can see the recurring payment details for the particular customer.

Magento2 Recurring Payment Subscription - Orders for the recurring payment section

Here, the admin can also cancel the customer subscriptions by selecting the subscription first and then from the Actions drop-down option select the Unsubscribe option as shown below in the snapshot.

Magento2 Recurring Payment Subscription - all-subscrition

After this, the admin can see a pop-up for Unsubscribing the selected Subscription, click Ok to confirm.

Magento2 Recurring Payment Subscription - unsubscribe

After this, the admin will see a confirmation message for the same.

Magento2 Recurring Payment Subscription - subscription unsubscribed success message

How To Create a Subscription Product?

Note – This extension supports simple, configurable, virtual, and downloadable product types.

To create a subscription product you need to navigate to the Catalog section and open any already created or new product. After that, go to the Subscription Configuration section for the product.

Here, set the Subscription option to Yes. After that, you will have to click the Edit Configuration button to add the subscription duration to this product.

Magento2 Recurring Payment Subscription - subscription configuration

This brings up the below section to choose the duration type for the product. Here, you need to check the subscription duration types to set for this product, enter the Subscription Title, Description(for a visible understanding), set an Initial Fee, and the subscription Charges applicable for the different chosen duration types.

Magento2 Recurring Payment Subscription - select subscription types

Lastly, click the Save button at the top to save the configuration settings.

Magento2 Recurring Payment Subscription - download

Customer Workflow

Magento 2 Recurring Payment Subscription advances the website front, the customer will see a Login to Continue button.

Magento2 Recurring Payment Subscription_dairy_product_frontend

After clicking the Login To Subscribe button, the user needs to login to his account on the website. And after which the customer can see the Subscribe button as shown below in the snapshot.

Magento2 Recurring Payment Subscription_dairy_product_frontend_subscribe_button

Tapping the Subscribe button will bring up the section to select any of the listed subscription plans. The customer can choose a plan that suits him best.

Here, the customer can see the details of the plan like – Name, description, Start Date, Initial Fee, Subscription Charges and a Subscribe Now button.

The customer has to select the start date for the subscription plan. Then click on the Subscribe Now button to proceed further.

Magento2 Recurring Payment Subscription_paypal_payment_select_subscription_start

This adds the product to the cart. You can also check the subscription details in the cart by scrolling.

Customers can add more than one subscription product.

Note: The date and duration type will be the same.

Magento2 Recurring Payment Subscription - date

If the date and duration type will not be the same, it shows like the below image.

Magento2 Recurring Payment Subscription - error

Click the Proceed to Checkout button to proceed to the checkout.

Magento2 Recurring Payment Subscription_paypal_payment_product_in_cart

Now, select your shipping address, shipping method and tap the Next button.

Magento2 Recurring Payment Subscription_checkout_page-1

Under the payment section, the customer can select to either to go with the Check/Money Order(offline method for purchasing the subscription).

Or PayPal Recurring Payment(Online Payment) method or Stripe Recurring Payment(Online Payment).

PayPal Recurring Payment: 

Post this, click the Place Order button.

checkout_page_payment_make_paypal_express

Post the above step, the customer is redirected to the PayPal login. The customer has to login to his PayPal account.

checkout_page_payment_make_paypal_express_at_paypal

Post that, select Accept and Continue to complete the payment for this particular order.

Magento2 Recurring Payment Subscription - paypal_make_payment_page

Stripe Recurring Payment: 

Now customers can also able to view the Stripe Recurring Payment method under the payment section. Post this, and click the Pay With New Card button.

Magento2 Recurring Payment Subscription - Stripe recurring payment method

Tapping to Pay With New Card button, the customer is redirected to the Stripe login. The customer has to login to his Stripe account.

Magento2 Recurring Payment Subscription - Webkul stripe recurring login

And then, select Accept and Continue to complete the payment for this particular order.

Note: Stripe recurring payment method only shows over the payment page if the subscription is selected from the current date.

Lastly, the customer can see the placed order details. Hence for more details check the below-given snapshot.

Magento2 Recurring Payment Subscription - order

Forthwith, to check the subscription details, the customer can navigate to My Subscription section. This sections is under the account panel as shown below in the snapshot.

Magento2 Recurring Payment Subscription - my-account

Here, the customers can see the overview of the subscriptions they have subscribed to and can view/Unsubscribe from the subscription as well.

Magento2 Recurring Payment Subscription - my-subscription

To view the subscription, tap the view button and you can see the details of the particular subscription.

Magento2 Recurring Payment Subscription - customer-subscribed

Now, The customers also have the option to unsubscribe to the opted subscriptions.

Afterward, to do so, the customer will tap on the Unsubscribe button and that brings up a pop-up confirmation for the same.

Thereupon tap the OK button to confirm the unsubscribe.

Magento2 Recurring Payment Subscription - click ok

Next tapping the OK button you can see that the subscription is unsubscribed.

Magento2 Recurring Payment Subscription - customer-unsubscribe

Support

That’s all for the Recurring Payment Subscription for Magento 2 (Adobe Commerce) extension. If you have any queries or doubts get back to us at support@webkul.com or raise a ticket at webkul.uvdesk.com

Explore the Adobe Commerce Cloud development service by Webkul. You may also browse other Magento 2 marketplace add-ons. Also our quality Magento 2 extensions.

Originally published on https://webkul.com/