Remember, it’s always a good idea to check the Zoho Books API documentation to make sure you’re not missing anything. Reading API docs in general is good practice anyway and sharpens your skills and understanding.
View the snippet below for creating an invoice.
Or, view the full code here
invoicesCreated = 0;
invoiceMap = Map();
invoiceMap.put("customer_id",customerID);
if(installments = 1)
{
info "Pay everything up front, generate 1 invoice";
des = "Discounted payment for the business plan";
lineItems = List();
lineItemMap = Map();
lineItemMap.put("item_id",itemID);
lineItemMap.put("description",des);
lineItemMap.put("rate",discount);
lineItemMap.put("quantity",1);
lineItems.add(lineItemMap);
invoiceMap.put("line_items",lineItems);
response = zoho.books.createRecord("Invoices",orgId,invoiceMap,"zohobooks");
info "Invoice created? " + response;
invoicesCreated = invoicesCreated + 1;
}