Scenario 8: PHP

From Intrannuity

Jump to: navigation, search

Download Source File

<?php
 
 
require_once "lib/iBilling.php";
 
	//Set up clients' settings
	$config = new HashMap();
	$config->put(SessionConnection::PROCESSOR_HOST, "http://server.ibillingclient.org/ibilling/xmlhttps");
	$config->put("debug", true);
	//Login
	$session = Session::login(2000, "welcome", $config);
	//Find payment plan
	$paymentPlan = $session->loadPaymentPlan("php.pp-2");
	//Add 2 freeze after first week
	$paymentPlan->add(1, 2, true);
	//Mark object for persistence
	$session->save($paymentPlan);
	//Synchronize changes with the server
	try{
		$session->synchronize();
	}
	catch(Exception $ex){
		//Be sure to properly handle exception, this is just a sample solution
		print($ex->getMessage());
		return ;
	}
	//Logout
	$session->logout();
 
 
 
?>
Personal tools