import ibilling.client.* import java.util.* public class Scenario10 { public static void main(String[] args) { //Set up clients' settings Map config = new HashMap(); config.put(SessionConnection.PROCESSOR_HOST, "http://server.ibillingclient.org/ibilling/xmlhttps"); config.put("debug", true); //Login Session session = Session.login(2000, "welcome", config); //Find customer account CustomerAccount customerAccount = session.loadCustomerAccount("java.ca-1"); //Create invoice for downpayment RevenueTransaction revenueTransaction = customerAccount.createRevenueTransaction(); //code is optinal; if you specify the value, make sure the code is unique revenueTransaction.setCode("java.rt-10"); //all amounts are in cents revenueTransaction.setAmount(5000); //Item Codes must be setup in portal prior to being used revenueTransaction.setItemCode("NutritionPack"); //Type of transaction revenueTransaction.setAccountActivityType(AccountActivityType.Invoice); //Create payment for downpayment AssetTransaction transaction = customerAccount.createAssetTransaction(); //code is optinal; if you specify the value, make sure the code is unique transaction.setCode("java.at-10"); //all amounts are in cents transaction.setAmount(5000); transaction.setTransactionType(AssetTransactionType.Cash); transaction.setAccountActivityType(AccountActivityType.Payment); //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 System.out.println(ex.getMessage()); return; } //logout session.logout(); } }