From Intrannuity
Download Source File
Imports System
Imports System.Collections.Generic
Imports iBilling.Client
Module Scenario3
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
Dim _session = Session.Login(2000, "welcome", config)
'Find customer account
Dim customerAccount = _session.LoadCustomerAccount("vb.ca-1")
'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-3"
'all amounts are in cents
paymentPlan.Amount = 3000
'Item Codes must be setup in portal prior to being used
paymentPlan.ItemCode = "Membership"
'Billing Cycle codes must be setup in portal prior to being used
paymentPlan.BillingCycleCode = "M03"
paymentPlan.Type = PaymentPlanTypes.Fixed
'Specify desired billing date; if nothing specified, next billing date of the selected cycle assumed.
'paymentPlan.FirstBillingDate = <DateTime>
paymentPlan.Add(0, 6, false)
'Create child payment plan
Dim childPaymentPlan = paymentPlan.CreateLinkedPaymentPlan()
'code is optinal; if you specify the value, make sure the code is unique
childPaymentPlan.Code = "vb.pp-3-1"
childPaymentPlan.Type = PaymentPlanTypes.Perpetual
'all amounts are in cents
childPaymentPlan.Amount = 2000
'Item Codes must be setup in portal prior to being used
childPaymentPlan.ItemCode = "Membership"
'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