require "lib/iBilling" #Set up clients' settings config = Map.new config.put(SessionConnection::PROCESSOR_HOST, "http://server.ibillingclient.org/ibilling/xmlhttps") config.put("debug", true) #Login session = Session::login(2000, "welcome", config) #execute find payment plan paymentPlan = session.loadPaymentPlan("rb.pp-3") charge = paymentPlan.charges.get(1) charge.isPrepaid = true #get customer account customerAccount = paymentPlan.customerAccount #Create payment for downpayment transaction = customerAccount.createAssetTransaction() #code is optinal; if you specify the value, make sure the code is unique transaction.code = "rb.at-5" #all amounts are in cents transaction.amount = 3000 #Type of transaction transaction.accountActivityType = AccountActivityType::Payment transaction.transactionType = AssetTransactionType::Check #check number transaction.accountNumber = "10100125687" transaction.isPrepayment = true transaction.dueDate = charge.billingDate #Mark object for persistence session.save(customerAccount) #Synchronize changes with the server begin session.synchronize() rescue Exception => ex #Be sure to properly handle exception, this is just a sample solution puts(ex.message) return end #Logout session.logout()