Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
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:
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.
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
// 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();
Last updated: Oct 21, 2014