Child pages
  • Subscription and Recurring Payments - Magento 2

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
width50%

Table of Contents

Warning

Firefox user notice:

Please use different web browser to view this document.

Sorry for the inconvenience.

Column
width30%

The Magento 2 Subscription & Recurring Payments module helps to effectively organize subscription services in a web store. Store admins can provide subscriptions for individual products by configuring various parameters, including payment gateways, repeat payments, subscription start dates, initial fees, trial payments, etc. Subscribed shoppers will be charged automatically once the subscription period starts and can track their subscription plan statuses from the dedicated tab in their store accounts.  

UI Button
titleProduct Page
colororange
urlhttps://ecommerce.aheadworks.com/magento-2-extensions/subscriptions-and-recurring-payments/
sizelarge

Thank you for choosing Aheadworks!

 


Installing Subscription and Recurring Payments

Section
Column
width50%

Command Line Installation

Panel
borderStylesolid
borderWidth2px

1. Backup your web directory and store database

Panel
borderStylesolid
borderWidth2px

2. Download Subscription and Recurring Payments installation package

Panel
borderStylesolid
borderWidth2px

 3. Upload contents of the Subscription and Recurring Payments installation package to your store root directory

Panel
borderStylesolid
borderWidth2px

 4. In SSH console of your server navigate to your store root folder:

No Format
cd path_to_the_store_root_folder

run:

No Format
php -f bin/magento module:enable Aheadworks_Sarp

then:

No Format
php -f bin/magento setup:upgrade

after:

No Format
php -f bin/magento setup:static-content:deploy
Panel
borderStylesolid
borderWidth2px

5. Flush store cache; log out from the backend and log in again

Note

Make sure the installation is done from under the FTP administrator account. Otherwise, make sure to set 775 permissions to the store root directory after the extension is deployed.

Column
width50%

Composer Installation

Panel
borderStylesolid
borderWidth2px

1. Log in to your customer account at https://ecommerce.aheadworks.com and navigate to Account -> Composer access;

Panel
borderStylesolid
borderWidth2px

2. Configure your store to work with the Aheadworks composer repository:

Add composer repository to composer.json by running:

composer config repositories.aheadworks composer https://dist.aheadworks.com/ in the Magento installation root.

Use a key pair provided as login and pass. You can optionally save them in the global composer auth file.

Panel
borderStylesolid
borderWidth2px

 3. You can start using AW composer now.

 For extension names, navigate to Account -> Composer access.

Panel
borderStylesolid
borderWidth2px

 4. Open the root Magento directory on your server and send Composer the following command:

composer require <component-name>:<version>

Note: Use the previously copied component name and version.

Panel
borderStylesolid
borderWidth2px

 5. Make sure that Composer finished the installation without errors. Flush store cache, log out and log into the backend again.

Payment Gateway Configuration

Authorize.NET

Section
Column
width50%
Panel
borderStylesolid
borderWidth2px

1) Log in to Admin > Stores > Configuration > Sales > Payment Methods and find Authorize.Net.

Panel
borderStylesolid
borderWidth2px

2) Set "Enabled" to "Yes".

Panel
borderStylesolid
borderWidth2px

3) Fill "API Login ID", "Transaction Key", "Merchant MD5" fields. You need to create a merchant account at Authorize.Net. Follow the instructions given at Authorize.Net side.

Panel
borderStylesolid
borderWidth2px

4) Once the Authorize.Net account is created navigate to Account > Settings > Silent Post URL

Set the Silent Post URL as:

No Format
yourstore.com/index.php/aw_sarp/authorizenet/silentpost/

Make sure to save the changes made.

Column
width50%

 

Stripe

Section
Column
width50%
Panel
borderStylesolid
borderWidth2px

1) Log in to Admin > Stores > Configuration > Sales > Payment Methods > Stripe(Subscriptions).

Panel
borderStylesolid
borderWidth2px

2) Fill "Live Secret Key", "Live Publishable Key". You need to create a merchant account at Stripe. Follow the instructions given at Stripe side.

When the account is created this data can be obtained from https://dashboard.stripe.com/ "API" tab.

Panel
borderStylesolid
borderWidth2px

3) At your Stripe account page navigate to Webhooks > Settings:

  • click "Add endpoint..." button
  • set URL as "yourstore.com/index.php/aw_sarp/stripe/webhook" and set "Mode = Live/Test".

Make sure to save the changes made.

PayPal Express Checkout

Section
Column
width50%
Panel
borderStylesolid
borderWidth2px

1) Log in to Admin > Stores > Configuration > Sales > Payment Methods > PayPal Express Checkout.

Panel
borderStylesolid
borderWidth2px

Required PayPal Express Checkout Settings

2) Fill in all the required fields, including API Username, API Password, and API Signature or API usernameAPI password, and Certificate authentification fields depending on API Authentification Methods. The email associated with your PayPal Merchant account is optional for Magento 2.

Note: Before filling the above fields you should create an account on PayPal.

The API Authentification Method has two options:

  • API Signature - the method that includes the API usernameAPI password, and PayPal signature authentification fields;
  • API Certificate - the method that includes API usernameAPI password, and the downloadable Certificate option as a set of authentification fields.

The Get Credentials from PayPal button, meanwhile, allows copying them to Magento automatically right after you login to your PayPal account.

Note: For testing purposes, you can also use Sandbox Mode and your Sandbox account.

Those Magento admins, who use proxy connecting to PayPal should also provide the server Host and Port parameters.

Panel
borderStylesolid
borderWidth2px

Basic PayPal Express Checkout Settings

3) Basic settings include:

  • Title - title of the payment method to be displayed;
  • Sort Order - position of the method in the list of all payment methods;
  • Payment Action - determines the logic of purchase approvements and payment withdrawals (detailed guide);
  • Display on Product Details Page - makes the method visible on product pages.

Make sure to save the changes made.

That's it. If necessary, you can also configure Advanced PayPal Express Checkout Settings.

Adyen

Section
Column
width50%

Adyen has extensive documentation on installing the payment method to Magento 2 store which can be found here: https://docs.adyen.com/developers/plug-ins-and-partners/magento/magento-2

Below we will describe in short how to make this happen.

Panel
borderStylesolid
borderWidth2px

1) Install Adyen extension at your store as another Magento 2 extension, and requires the upgrade and deploy stages.

The package can be obtained from:https://github.com/Adyen/adyen-magento2

Panel
borderStylesolid
borderWidth2px

2) Install Adyen library via composer: https://github.com/Adyen/adyen-php-api-library

No Format
composer require adyen/php-api-library
Panel
borderStylesolid
borderWidth2px

3) Create an account at Adyen. Make sure you have received the Account and Username information to your email.

Panel
borderStylesolid
borderWidth2px

4) Set up the account as described in the Adyen documentation here.

Panel
borderStylesolid
borderWidth2px

5) And set up the store as per documentation:

  • "Required Settings" tab: fill in Merchant Account (Adyen > Accounts > Account Code);
  • "Required Settings" tab: set up Test/Production Mode;
  • "Required Settings" tab: fill in Notification User Name/Email (these are the Adyen credentials);
  • "Required Settings" tab: fill in Webservice username/Email for Test (Adyen > Settings > Users > select Web Service user > User Account Details: User Name/Password);
  • "CreditCard API integration" tab: fill in Enter CSE Public Key of Test Adyen Web Service User (Adyen > Settings > Users > select Web Service user > Easy Encryption: Client Encryption).

Make sure to save the changes made.

Note: For the purposes of the extension, Adyen processes only the payments by credit cards.

Column
width50%

 


Introducing Subscriptions and Recurring Payments

Section

Subscription and Recurring Payments extension adds an option to purchase products as subscriptions:

  • Payments processed via external payment gateways (PayPal express, Authorize.Net, Adyen and Stripe currently);
  • Checkout with multiple subscription products at the same time;
  • Configurable and bundle products support;
  • Trial and initial fees for the subscriptions;
  • Multi-store and multi-lingual;
  • Adjustable billing and shipping subscription addresses.

The extension allows store owners to offer regular products as subscriptions. The extension does not convert products into subscriptions, instead, it adds an option to the checkout with a product as a regular item or as a subscription. Depending on the extension settings, store owners can decide if they want to offer products as subscription-only or let their customers choose whatever delivery type they want.

Subscription profiles created within an extension are shared across all the products. Per single subscription plan store owners can configure: the number of payments, recurring settings (daily, weekly, monthly, every X days), pricing settings, and description. All other settings are available at the product level.

Whenever the subscription plans configured 'Subscribe' button becomes available at the corresponding product pages. Subscription products are added to the subscription cart, not to interfere with the native checkout process. Subscription checkout is transparent and represented as four steps with the progress bar, customers should take to place an order. Though the steps customers can look around and read detailed information on the subscription plans available, select required shipping options, and specify billing and shipping addresses, just as with the native checkout.

Upon placing an order, customers are redirected to the payment gateway side, where the recurring profile is created. After, customers will be charged every X days set in the subscription plan and orders will be created automatically at the Magento side, available for processing by the store administrator.

 


Getting Around

Section

Once installed, the extension introduces its pages to the Sales section of Magento 2 navigation menu. From here, store administrator has an access to the following pages:

  • Subscriptions - main subscription management screen, that lists all active subscriptions at the store with an overview of the most important subscription attributes;
  • Subscription plans - a section with a list of subscription plans, where store administrator creates and manages subscription plans.

Thesetwosectionarethe parts of Subscription and Recurring Payments "control center". When the extension is properly configured all the subscription management takes place here.

In addition to Sales section, the extension introduces its general configuration options to Stores > Configuration > Aheadworks extensions > Subscription and Recurring Payments. Configuration options control basic extension aspects.

 

Sections in this user guide are represented in an order preferred for setting up the extension. It starts with creating subscription plans, setting up existing products for subscriptions, configuring general extension settings, getting acquainted with the process of subscribing to products, and managing subscriptions from both store backend and frontend. If you are new to the extension we advise you to follow the user guide as it goes in order to get understanding of how to work with the extension on your own.


Creating subscription plans

Section

Plan grid

Subscription Plans is the section one starts with to set up the extension. All the basic information about how the subscriptions work and will work per your requirements can be found here. It can be found under Sales > Subscription and Recurring Payments by Aheadworks > Subscription plans.

Subscription Plan is the basic element of the extension. Once created, subscription plans are shared among all the products with subscription options set. It defines how many times customers will be charged, the time interval of the subscription payments and other necessary information.

This is the section where store administrator creates and manages subscription plans. It is represented by the grid listing all the subscription plans ever created, both enabled and disabled. The grid comes with the following control elements, that are shared across all other grids alike in the Aheadworks products:

  •  button allows customizing the grid look by hiding, applying columns. Some columns may be excessive and some relevant to the current tasks;
  •  button allows looking for particular subscription plan depending on the filters selected. Filters include all available subscription plan attributes;
  •  button allows saving the perfect grid look to quickly load it whenever required.

New Plan

To create new subscription plan click button.

New Subscription plan page settings are thematically split into four blocks: General Information, Schedule, Additional Pricing Settings, Storefront Description.

General Information

As it follows from its name, the block lists common plan settings:

  • Status - allows enabling/disabling subscription plan;
  • Website - defines a website the plan should be available at;
  • Name - allows defining a subscription plan name for internal identification purposes.
  • Subscription engine - allows selecting a payment method available for the subscription plan.

Schedule

The block controls the most important aspects of the subscription plan - how many times and at what intervals customers will be charged, along with the subscription start date:

  • Number of Payments - defines how many times customers will be charged (the number of orders created accordingly);
  • Repeat Payments - defines how ofter customers will be charged:
    • Setting values depend on the selected payment gateway.
  • Subscription start date - defines if the subscription will start at the moment of purchase, the exact day of a month, last day of current month, or on the date defined by a customer.
Info

Total subscription period = Number of Payments * Repeat Payments

Note

Stripe payment method only supports infinite subscription plans. Meaning that the product will be ordered for every set time interval until the subscription is canceled.

Additional Pricing Settings

This section controls all additional subscription plan payment options:

  • Enable Initial Fee - defines if the initial fee is enabled for this subscription plan. Initial fee value is set on the product level;
  • Enable Trial Period - defines if the trial period is enabled for this subscription plan. Trial Period price is set at the product level.
  • Number of Trial Payments - defines the number of trial period payments in this period. Make sure to enter the value that doesn't contradict Number of Payments setting.

Storefront Description

In this section store administrator sets the subscription plan name and description that will be displayed to the customers at the store frontend:

  • Store View - defines the store view this plan title and description will be displayed at;
  • Title - name of the subscription plan;
  • Description - subscription plan description that supports HTML where store administrator is suggested to describe subscription options and benefits.

Additional store view descriptions can be added by clicking button.

 

Once every plan setting is configured store administrator can click button to proceed to the product configuration.

 


Product configuration

Section

Once at least a single Subscription Plan has been created and configured, it is possible to start offering products by subscription. The extension doesn't add new product type with a limited set of options to the store, instead, it allows store administrator to offer existing products as subscriptions.

Subscription settings are added to all product types (except grouped products) and can be found in the Subscription Configuration section of the product details page.

Note

The extension does NOT work with the groupped product type.

 

There is a total of four settings:

  • Subscription - defines if the product should be distributed as a single time purchase, only as a subscription, or available for both: subscription and a single purchase;
  • Regular Payment Price - defines the price of a regular subscription payment. If the Regular Payment Price is lower than an original product price, the %-difference can be displayed on the product page (will be covered later);
  • Trial Price - defines the price of single subscription period if the trial is available;
  • Initial Fee - defines an initial fee that customer will have to pay for placing a subscription order. It is a single payment that is processed separately.

The extension defining option is, of course, Subscription, as it defines if the product is available on the recurring basis. The option is disabled by default for all products.

For configurable products, such options can be configured per item, meaning that you can define different Regular Payment Prices for different product configurations.

 


Extension log

Section

Starting with version 1.3.0 the extension comes with the Subscription Log that stores all the subscription updates and customer and store administrator actions.

The log comes with the same control elements as the Subscription Plans grid, that allow for particular entries search and filtering.

In case the log needs to be cleared the store administrator uses button.

 


General settings

Section

Now we will proceed to the General Settings of the extension. The settings can be found under Stores > Configuration > Aheadworks extensions > Subscription and Recurring Payments.

The settings define how the extension behaves when dealing with taxes and how it should look like on the store frontend:

  • Apply Tax on Trial Amount - defines if product taxes should be applied to the trial period payments of the extension;
  • Apply Tax on Shipping Amount - defines if product taxes should be applied to the shipping amount when customer decides on the shipping options;
  • Display "You Save X %" on Product Page - defines is %-difference between original item price and subscription price should be displayed at the 'Subscribe' button on the product page;
  • Tooltip Near Subscription Button on Product Page - allows displaying a tooltip for the subscription option below the 'Subscribe' button at the product pages;
  • Keep Log for, days - defines for how many days the extension log is kept.

 


Storefront

Section

Subscription product

If you are reading this user guide section, you have probably added subscription options to at least one product. Depending on the subscription options selected the subscription will look something like this:

Here is the product with Subscription option set to 'Optional', meaning it allows purchasing a product as both, single item and a subscription. Such products will have two buttons displayed at once: Add to Cart and Subscribe.

Native price attribute of this product has been set to $15, while the subscription price set to $12,5. That's it why one can see that subscribing to this product supplies will save 16% total. This, and because option Display "You Save X %" on Product Page of the General Settings has been set to 'Yes'.

The product at the image above is the configurable product, child products of the configurable one may have individual Subscription Price set to all of them, and while switching parent product options the 'Subscribe' button will always display relevant discount customer gets.

Checking out

All subscription products are added to the subscription cart, it is a dedicated shopping cart for the subscriptions. This dedicated cart has been introduced to avoid issues with the payment gateways, as most of the payment processors can either process a single-time payment or create a recurring profile.

When a customer clicks the 'Subscribe' button they are redirected to the Subscription Cart/Checkout page:

The Subscription Cart page represents a progress bar of four steps which indicate the checkout process.

  • At the first step, customers are suggested to select the subscription plan. The plans come in individual blocks that are automatically adjusted to the screen borders. Each block contains subscription plan Title and Description. In addition, customers can click 'See more details' below the button to get a comprehensive overview of all the subscription terms.
  • Upon clicking button, customers proceed to the second checkout step. Here customers are represented with the subscription total overview for the first order. This step has been introduced to secure customer's choice on the subscription and its start date. When everything is considered, the customer clicks button to proceed to the third step.
  • The third step is the step of the native Magento 2 checkout, where customers are suggested to leave their Shipping and Billing addresses and decide on the shipping method.
  • The fourth step is the payment confirmation.

Once the subscription order has been placed, a customer can navigate to his account at the store to check all the active subscriptions.

Customer account section

The extension introduces My Subscriptions section to customer account dashboard. The section lists all the customer's subscriptions active or expired.

Looks like our test customer has subscribed to weekly deliveries of the Shoulder Packs for three months! An interesting decision. We should probably give props to the store owner who thought it was a great idea to offer shoulder packs by subscription.

From this page, by clicking 'View' link of the required subscription customer can go in-depth to look for all associated orders and adjust billing and shipping information, in case the shoulder pack should be delivered to another address.

Subscription details page also allows customers to Suspend and Cancel subscription anytime required.

 


Store back

Section

Every time a customer subscribes a dedicated entry is created at the Sales > Subscription and Recurring Payments by Aheadworks > Subscriptions grid.

Here store administrator is represented with an overview of all active, suspended, canceled and expired subscriptions. With the Actions block, store administrator can also cancel and suspend selected subscriptions.

By clicking a Subscription Profile ID store administrator can check all the orders associated with the subscription and all other details just like with native Magento order details page.

Working with Adyen

Section

When working with Adyen subscriptions, the store owner must consider the following:

1) If the subscription is NOT infinite, then disregarding the time suspended, the specified number of cycles (payment periods) will be processed.

Info

For example:

Customer subscribed for 6 months. Subscription has been active for 3 months, the customer took a month break. After the subscription is reactivated,customerwillstillhave3moremonthofsubscriptionand will be charged accordingly.

2) The payment dates will not be transitioned to the end of the period after the subscription is reactivated.

Info

For example:

There are two payments planned for 10th and 20th of the month.

10th payment is processed and customer suspends the subscription for 5 days.

On the 15th customer reactivates the subscription.

On the 20th customer is charged with another payment.

3) Considering the two peculiarities above, whenever customer suspends and reactivates the subscription, the missed billing cycle is transferred to the closest planned billing date.

Meaning that all the missed billing periods are placed in the queue and are processed regularly.

UI Button
titleProduct Page
colororange
urlhttps://ecommerce.aheadworks.com/magento-2-extensions/subscriptions-and-recurring-payments/


You can always find the latest version of the software, full documentation, demos, screenshots, and reviews on http://ecommerce.aheadworks.com
License agreement: https://ecommerce.aheadworks.com/end-user-license-agreement/
Contact Us: http://ecommerce.aheadworks.com/contacts/
Copyright © 2018 Aheadworks Co. http://www.aheadworks.com