This content is archived. See latest version here

Last updated: Oct 21 2014

EPiServer Commerce supports both purchase orders and payment plans/subscriptions. Both aremeta classes which allows for configuration to store field information appropriateto your implementation. To use payment plans/subscriptions, you use thePaymentPlan class.

The PaymentPlan class contains properties which allow youto store information unique to payment plans, for instance cycle length, start date, and enddate. When a payment/subscription plan is submitted by a customer, the cart canthen be saved as a PaymentPlan (as opposed to a PurchasePlan) by using the Cart.SaveAsPaymentPlan() method.

Classes referred to here are available in the following namespaces:

Key classes and files

  • OrderGroup - base class for PaymentPlan. Its also the base class for the Cart and PurchaseOrderclasses. This means that the PaymentPlan class contains OrderForm, Shipment, Payment, and LineIteminstances 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 will 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 clicking OK. To create new meta fields, navigate to the Meta Fields node and select New Meta Field.

Saving a payment plan

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.

Example: setting the properties of a payment plan with scheduled payments

C#
// 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();

Do you have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/