From Intrannuity
Download Source File
<cfscript>
// Create Session component
session = CreateObject( 'component', 'Session' );
session.login(2000, "password", "http://server.ibillingclient.org/ibilling/xmlhttps");
// Find customer account
customerAccount = session.loadCustomerAccount("cfs.ca-1");
// Create payment plan
paymentPlan = customerAccount.createPaymentPlan();
// code is optinal; if you specify the value, make sure the code is unique
paymentPlan.setCode("cfs.pp-3");
// all amounts are in cents
paymentPlan.setAmount(3000);
// Item Codes must be setup in portal prior to being used
paymentPlan.setItemCode("Membership");
// Billing Cycle codes must be setup in portal prior to being used
paymentPlan.setBillingCycleCode("M03");
paymentPlan.setType(session.PaymentPlanType().Fixed());
// Specify desired billing date; if nothing specified, next billing date of the selected cycle assumed
// paymentPlan.setFirstBillingDate(<Date>);
paymentPlan.add(0, 6, false);
// Create child payment plan
childPaymentPlan = paymentPlan.createLinkedPaymentPlan();
// code is optinal; if you specify the value, make sure the code is unique
childPaymentPlan.setCode("cfs.pp-3-1");
childPaymentPlan.setType(session.PaymentPlanType().Perpetual());
// all amounts are in cents
childPaymentPlan.setAmount(2000);
// Item Codes must be setup in portal prior to being used
childPaymentPlan.setItemCode("Membership");
// Mark object for persistence
session.save(customerAccount);
// Synchronize changes with the server
try{
session.synchronize();
}
catch(Exception ex){
// Be sure to properly handle exception, this is just a sample solution
WriteOutput(ex.message);
return ;
}
// logout
session.logout();
</cfscript>
Download Source File