Global API
...
Request
Bill
Create
1min
the following is an example of creating a bill where we are setting every possible field (see bill docid\ mpzpcquzr oqlfeonw3y9 for the available fields) the response will return the exact request data plus the new quickbooks bill id (id) note you can only create one record at a time request // create a map to store all the data of a bill map\<string, object> billmap = new map\<string, object>(); list\<object> lineitemlist = new list\<object>(); list\<object> billlist = new list\<object>(); //assign value of opportunity to quickbook bill 	 billmap put('txndate','2024 04 26'); billmap put('duedate','2024 05 26'); billmap put('docnumber', '0001'); billmap put('privatenote','create bill'); billmap put('trackingnumber','12'); billmap put('globaltaxcalculation','notapplicable'); billmap put('salestermref' , new map\<string, object>{'value' => '2' }); billmap put('vendorref' , new map\<string, object>{'value' => '67' }); 	 // assign value of opportunitylineitem to quickbook bill map\<string, object> lineitemmap = new map\<string, object>(); map\<string, object> saleslineitemdetailmap = new map\<string, object>(); map\<string, object> discountitemdetailmap = new map\<string, object>(); lineitemmap put('description','description'); lineitemmap put('detailtype','itembasedexpenselinedetail'); lineitemmap put('amount',10000); 	 saleslineitemdetailmap put('itemref', new map\<string, object>{'value' => '19'}); saleslineitemdetailmap put('taxcoderef', new map\<string, object>{'value'=>'non'}); saleslineitemdetailmap put('qty','10'); saleslineitemdetailmap put('unitprice','1000'); 	 	 if(lineitemmap get('detailtype') == 'accountbasedexpenselinedetail'){ lineitemmap put('accountbasedexpenselinedetail',saleslineitemdetailmap); }else if(lineitemmap get('detailtype') == 'itembasedexpenselinedetail'){ lineitemmap put('itembasedexpenselinedetail',saleslineitemdetailmap); } lineitemlist add(lineitemmap); 	 	 // adding the line items to quickbook bill billmap put('line',lineitemlist); billlist add(billmap); 	 map\<string, object> reqjsonmap = new map\<string, object>(); reqjsonmap put('bill' , billlist); string reqjson = json serialize(reqjsonmap); 	 map\<string, object> finalreqmap = new map\<string, object>(); map\<string,object> reqoptions = new map\<string,object>(); finalreqmap put('options' , reqoptions); finalreqmap put('version' , '1 0'); finalreqmap put('action' , 'createbill'); finalreqmap put('requestjson' , reqjson); //required, if quickbooks multi org is enabled in breadwinner finalreqmap put('qborgid' , '4620816365285051610'); finalreqmap put('skipdml' , false); system debug('request ' + finalreqmap); 	 map\<string, object> respmap = breadwinner qbo breadwinnerqbapi call(finalreqmap); system debug('response ' + respmap); response { statuscode 200, timestamp=1716961105479, validrequest=true, version=1 0, bill \[ { "vendorref" { "value" "67", "name" "3 39" }, "txndate" "2024 04 26", "totalamt" 10000 00, "synctoken" "0", "sparse"\ false, "sfrecordid" "a01ig000000pdsyiac", "salestermref" { "value" "2" }, "privatenote" "create bill", "metadata" { "lastupdatedtime" "2024 05 28t22 38 24 07 00", "createtime" "2024 05 28t22 38 24 07 00" }, "line" \[ { "linenum" 1, "itembasedexpenselinedetail" { "unitprice" 1000, "taxcoderef" { "value" "non" }, "qty" 10, "itemref" { "value" "19", "name" "genwatt diesel 1000kw" }, "billablestatus" "notbillable" }, "id" "1", "detailtype" "itembasedexpenselinedetail", "description" "description", "amount" 10000 00 } ], "id" "229", "duedate" "2024 05 26", "docnumber" "0001", "currencyref" { "value" "usd", "name" "united states dollar" }, "balance" 10000 00, "apaccountref" { "value" "33", "name" "accounts payable (a/p)" } } ] } }