You are here: Order System > Recurring Orders

Recurring Orders

Overview

EPiServer Commerce supports both purchase orders and payment plans/subscriptions. Both are meta classes which allows for configuration to store field information appropriate to your implementation. To use payment plans/subscriptions, you use the PaymentPlan class. The PaymentPlan class contains properties which allow you to store information unique to payment plans (e.g. cycle length, start date, end date, etc).

When a payment/subscription plan is submitted by a customer, the cart can then be saved as a PaymentPlan (as opposed to a PurchasePlan) by using the Cart.SaveAsPaymentPlan() method. In addition, A Quartz service is included which allows you to process payments for payment plans automatically.

Classes and Files

OrderGroup - The base class for PaymentPlan. Its also the base class for the Cart and PurchaseOrder classes. This means that the PaymentPlan class contains OrderForm, Shipment, Payment, and LineItem instances just like a Cart.
PaymentPlan - Meta class for payment plans/subscriptions.

Configuring The PaymentPlan Meta Class

In the Administration section of Commerce Manager, navigate to the Order System/Meta Classes node. Here you'll find that you can access and modify all of the meta classes in the order system. The PaymentPlan meta class can be found by selecting the Element "OrderGroup" and Type"PaymentPlan". Here, you can determine which meta fields are associated with the PaymentPlan meta class by checking the checkboxes for the desired meta fields and pressing OK. To create new meta fields, navigate to the Meta Fields node and select New Meta Field.

Saving a PaymentPlan

When submitting a payment plan/subscription (saving a cart as a payment plan), use the Cart.SaveAsPaymentPlan() method. Also, you can then set the properties of a payment plan relating to the schedule of payments. Here's an example of this:

// Create payment plan
  PaymentPlan plan = cart.SaveAsPaymentPlan();
 
  // Set some payment plan values
  // Monthly subscription for a year
  plan.CycleMode = PaymentPlanCycle.Months;
  plan.CycleLength = 1;
  plan.MaxCyclesCount = 12;
  plan.StartDate = DateTime.UtcNow;
  plan.EndDate = DateTime.UtcNow.AddMonths(13);
  plan.LastTransactionDate = DateTime.UtcNow;
 
  // Save changes
  plan.AcceptChanges();

Using the Quartz Service

To use the Quartz Service, follow the directions here:

Recurring Jobs and Quartz Service

Namespaces

Mediachase.Commerce.Orders - Contains OrderGroup and PaymentPlan

 


Version: EPiServer Commerce 1 R2 SP2| Last updated: 2012-06-29 | Copyright © EPiServer AB | Send feedback to us