#include "stdafx.h" using namespace System; using namespace System::Collections::Generic; using namespace iBilling::Client; int Scenario3(array ^args) { //Set up clients' settings; Dictionary^ config = gcnew Dictionary(); config[SessionConnection::PROCESSOR_HOST] = "http://server.ibillingclient.org/ibilling/xmlhttps"; config["debug"] = true; Session^ session = Session::Login(2000, "welcome", config); //Find customer account; CustomerAccount^ customerAccount = session->LoadCustomerAccount("cpp.ca-1"); //Create payment plan; PaymentPlan^ paymentPlan = customerAccount->CreatePaymentPlan(); //code is optinal; if you specify the value, make sure the code is unique; paymentPlan->Code = "cpp.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 = ; paymentPlan->Add(0, 6, false); //Create child payment plan; PaymentPlan^ childPaymentPlan = paymentPlan->CreateLinkedPaymentPlan(); //code is optinal; if you specify the value, make sure the code is unique; childPaymentPlan->Code = "cpp.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(Exception^ ex){ //Be sure to properly handle exception, this is just a sample solution; Console::WriteLine(ex->Message); return 0; } //logout; session->Logout(); return 0; }