From Intrannuity
Download Source File
<cfscript>
// Create Session component
session = CreateObject( 'component', 'Session' );
// Login
session.login(2000, "password", "http://server.ibillingclient.org/ibilling/xmlhttps");
// Create customer account
customerAccount = session.createCustomerAccount();
// code is optinal; if you specify the value, make sure the code is unique
customerAccount.setCode("cfs.ca-4");
customerAccount.setMerchantAccountCode(2001);
customerAccount.setFirstName("Mary");
customerAccount.setLastName("Doe");
customerAccount.setType(session.CustomerAccountType().Female());
customerAccount.setHomePhone("5469856876");
customerAccount.setEmail("test@google.com");
customerAccount.setStreet1("203 16th Street");
customerAccount.setCity("Honolulu");
customerAccount.setState("CA");
customerAccount.setZipCode("30904");
// Create payment plan
paymentPlan = customerAccount.createPaymentPlan();
// code is optinal; if you specify the value, make sure the code is unique
paymentPlan.setCode("cfs.pp-4");
// all amounts are in cents
paymentPlan.setAmount(3000);
// Item Codes must be setup in portal prior to being used
paymentPlan.setItemCode("Membership");
paymentPlan.setType(session.PaymentPlanType().Complimentary());
// Billing Cycle codes must be setup in portal prior to being used
paymentPlan.setBillingCycleCode("M03");
// Specify desired billing date; if nothing specified, next billing date of the selected cycle assumed
// paymentPlan.setFirstBillingDate(<Date>);
// 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