Skip to content

Overview

VirtoCommerce.Subscription module represents subscriptions and recurring orders management system. It enables retailers to sell subscription-based offerings and shoppers to place recurring orders online.

Subscription module

Key features

  • Trial periods
  • Grace periods
  • Free subscriptions
  • Product or bundle selling on a subscription
  • Multiple products via one subscription
  • View a list of existing subscriptions with filtration and sorting
  • View full subscription history with all notifications, invoices and changes
  • Update active subscriptions (including payment plan changes)
  • Manual invoicing on subscription with any amount
  • Notifications for each life phase and subscription events
  • Possibility to use templates for notifications;
  • Possibility to edit notification templates and manage the list of notification types
  • View information about upcomming Invoice

Scenarios

Recurring order scenario

  1. Customer adds products to cart and proceeds to checkout;
  2. Customer selects "I want this to be a recurring order" option: Fig.Recurring order
  3. Customer sets the recurrence parameters: Fig. Autoorder
  4. Customer proceeds with the checkout and submits the order;
  5. System creates both the order and a subscription based on that order;
  6. System background job checks periodically the existing subscriptions and generates new orders (if needed);
  7. System sends email notification to the customer about the new order;
  8. Customer receives the email and clicks the link to open the order in storefront;
  9. Customer reviews the order and confirms payment;
  10. Alternatively, customer opens the associated subscription and cancels it. No more new orders would be generated for this subscription ever again.

Recurring order workflow

Subscription scenario

  1. Customer Service Representative (CSR) creates a new product and defines auto-order schedule for it on admin side; Fig. Autoreorder schedule
  2. Customer orders the product on storefront;
  3. The system displays the subscription schedule under the product; Fig. Subscription period
  4. There will be no possibility to select "I want this to be a recurring order" during checkout;
  5. The following steps are identical to the ones in "Recurring order scenario" starting from step 5.

Subscription workflow

Subscription states

Subscription "UML state machine" diagram:

Subscription state machine

Data flows

Subscriptions are used for generating new Orders under some rules. That is why we always store 2 entities: Subscription and associated Order. The latter we call a "prototype Order" as future Orders will be generated from it.

  1. When a Customer creates an Order on storefront, it's sent to Orders service;
  2. Orders service saves the Customer Order to database and also fires OrderChangeEvent even;
  3. Subscription module receives OrderChangeEvent (containing the Order);
  4. If this was a newly created Order with associated payment plan (and not a prototype for some Subscription), then:

    1. Create a new Subscription - clone given Order and associate it with the new Subscription. If the received Order was generated by a Subscription, then the Subscription should be updated (status, balance recalculated, etc.). This includes the scenario when new Order was generated by Process Subscription Job.
  5. At the step the Subscription module creates a scheduled job that initiates Subscription processing periodically. It reads active Subscriptions from database and generates new Orders (if needed).

Subscription data flows

Installation

Installing the module:

Settings

  • Subscription.EnableSubscriptions - Flag for activating subscriptions in store;
  • Subscription.Status - Subscription statuses (Trialling, Active, Cancelled, Expired, etc.);
  • Subscription.SubscriptionNewNumberTemplate - The template (pattern) that will be used to generate the number for new Subscription. Parameters: 0 - date (the UTC time of number generation); 1 - the sequence number;
  • Subscription.EnableSubscriptionProccessJob - Flag for activating automatic subscription process
  • Subscription.EnableSubscriptionOrdersCreatejob - Flag for activating automatic order creation for subscription
  • Subscription.CronExpressionOrdersJob - Cron expression for scheduling subscription order creation job execution
  • Subscription.PastDue.Delay - Delay in days when unpaid subscription obtain PastDue status

  • Subscription.CronExpression - cron expression for scheduling subscription processing job execution.

Available resources


Last update: May 11, 2021