From Intrannuity
Download Source File
Imports System
Imports System.Collections.Generic
Imports iBilling.Client
Module Scenario4
Sub Main()
'Set up clients' settings
Dim config = new Dictionary(Of String, Object)()
config(SessionConnection.PROCESSOR_HOST) = "http://server.ibillingclient.org/ibilling/xmlhttps"
config("debug") = true
'Login
Dim _session = Session.Login(2000, "welcome", config)
'Create customer account
Dim customerAccount = _session.CreateCustomerAccount()
'code is optinal; if you specify the value, make sure the code is unique
customerAccount.Code = "vb.ca-4"
customerAccount.MerchantAccountCode = 2001
customerAccount.FirstName = "Mary"
customerAccount.LastName = "Doe"
customerAccount.Type = CustomerAccountTypes.Female
customerAccount.HomePhone = "5469856876"
customerAccount.Email = "test@google.com"
customerAccount.Street1 = "203 16th Street"
customerAccount.City = "Honolulu"
customerAccount.State = "CA"
customerAccount.ZipCode = "30904"
'Create payment plan
Dim paymentPlan = customerAccount.CreatePaymentPlan()
'code is optinal; if you specify the value, make sure the code is unique
paymentPlan.Code = "vb.pp-4"
'all amounts are in cents
paymentPlan.Amount = 3000
'Item Codes must be setup in portal prior to being used
paymentPlan.ItemCode = "Membership"
paymentPlan.Type = PaymentPlanTypes.Complimentary
'Billing Cycle codes must be setup in portal prior to being used
paymentPlan.BillingCycleCode = "M03"
'Specify desired billing date; if nothing specified, next billing date of the selected cycle assumed.
'paymentPlan.FirstBillingDate = <DateTime>
'Mark object for persistence
_session.Save(customerAccount)
'Synchronize changes with the server
Try
_session.Synchronize()
Catch ex As Exception
'Be sure to properly handle exception, this is just a sample solution
Console.WriteLine(ex.Message)
Exit Sub
End Try
'Logout
_session.Logout()
End Sub
End Module