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