Global API
...
Request
Sales Receipt

Create

1min
the following is an example of create sales receipt where we are setting every possible field (see sales receipt docid\ ehs2xojrohwurgt hgng2 for the available fields) the response will return the exact request data plus the new quickbooks sales receipt id (id) and the newly created salesforce sales receipt id (salesforcerecordid) note you can only create one record at a time request // create a map to store all the data of a sales receipt list\<object> salesreceiptlist = new list\<object>(); map\<string, object> salesreceiptmap = new map\<string, object>(); salesreceiptmap put('txndate', '2021/08/11'); salesreceiptmap put('duedate', '2021/09/11'); // initializing the sales receipt custom fields list\<object> customfieldlist = new list\<object>(); map\<string, object> customfiel1dmap = new map\<string, object>(); customfiel1dmap put('definitionid','1'); customfiel1dmap put('type','stringtype'); customfiel1dmap put('stringvalue','received'); customfieldlist add(customfiel1dmap); // adding the sales receipt custom fields salesreceiptmap put('customfield',customfieldlist); salesreceiptmap put('address',new map\<string, object>{'freeformnumber' => '+919090909090'}); salesreceiptmap put('customerref',new map\<string, object>{'value' => '29'}); // initializing the billing address map\<string, object> billaddrmap = new map\<string, object>(); billaddrmap put('city' , 'suryapet'); billaddrmap put('country' , 'india'); billaddrmap put('line3' , 'kodad'); billaddrmap put('line2' , 'first lane'); billaddrmap put('line1' , '1 24'); billaddrmap put('postalcode' , '508238'); billaddrmap put('countrysubdivisioncode' , ''); salesreceiptmap put('billaddr',billaddrmap); // initializing the sales receipt line items list\<object> lineitemlist = new list\<object>(); map\<string, object> lineitemmap = new map\<string, object>(); lineitemmap put('linenum',1); lineitemmap put('amount',100); lineitemmap put('description','description'); &#x9; lineitemmap put('detailtype', 'salesitemlinedetail'); map\<string, object> saleslineitemdetailmap = new map\<string, object>(); saleslineitemdetailmap put('itemref' , new map\<string, object>{'value' => '1'}); &#x9; saleslineitemdetailmap put('taxcoderef' , new map\<string, object>{'value' => 'tax'}); saleslineitemdetailmap put('servicedate','1993/05/25'); //yyyy/mm/dd saleslineitemdetailmap put('qty',2); saleslineitemdetailmap put('unitprice',50); saleslineitemdetailmap put('taxinclusiveamt',22); lineitemmap put('salesitemlinedetail', saleslineitemdetailmap); lineitemlist add(lineitemmap); // adding the line items to sales receipt salesreceiptmap put('line',lineitemlist); salesreceiptlist add(salesreceiptmap); // initializing the requestjson data to be passed map\<string, object> reqjsonmap = new map\<string, object>(); reqjsonmap put('salesreceipts' , salesreceiptlist); 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' , 'createsalesreceipt'); finalreqmap put('requestjson' , reqjson); finalreqmap put('skipdml' , false); //required, if quickbooks multi org is enabled in breadwinner finalreqmap put('qborgid', '4620816365285051610'); system debug('request ' + finalreqmap); // placing a request to breadwinner global api map\<string, object> respmap = breadwinner qbo breadwinnerqbapi call(finalreqmap); system debug('response ' + respmap); response { action=createsalesreceipt, responsejson={ "statuscode" 200, "salesreceipts" \[ { "txntaxdetail" { "totaltax" 0 }, "txndate" "2021 08 11", "totalamt" 100 00, "synctoken" "0", "sparse" false, "sfrecordid" "a0a5j000000u9jreaa", "metadata" { "lastupdatedtime" "2021 11 01t23 15 23 07 00", "createtime" "2021 11 01t23 15 23 07 00" }, "line" \[ { "salesitemlinedetail" { "unitprice" 50, "taxcoderef" { "value" "tax" }, "servicedate" "1993 05 25", "qty" 2, "itemref" { "value" "1", "name" "services" } }, "linenum" 1, "id" "1", "detailtype" "salesitemlinedetail", "description" "description", "amount" 100 00 }, { "detailtype" "subtotallinedetail", "amount" 100 00 } ], "id" "159", "emailstatus" "notset", "deposittoaccountref" { "value" "4", "name" "undeposited funds" }, "customfield" \[ { "type" "stringtype", "stringvalue" "received", "name" "crew #", "definitionid" "1" } ], "customerref" { "value" "29", "name" "weiskopf consulting" }, "currencyref" { "value" "usd", "name" "united states dollar" }, "billaddr" { "postalcode" "508238", "line3" "kodad", "line2" "first lane", "line1" "1 24", "id" "135", "country" "india", "city" "suryapet" }, "balance" 0 } ] }, timestamp=1635833725384, validrequest=true, version=1 0 }