Send Invoice
1 min
When sending an Invoice, use the requestJSON to pass the required Invoice data. The returned response will contain a responseJSON section with the Send Invoice response returned by Breadwinner for QuickBooks.
The following is an example of Send Invoice. The QuickBooks Invoice ID (InvoiceId) is required to send the Invoice.
Note: An Email address is required to send the Invoice. If there is an email address on the invoice, you only need to pass in the Invoice ID. If the invoice does not have an email address, or you want to send it to a different address, you must also supply the 'SendTo' parameter.
// Create a Map to store all the data of an Invoice
Map<String, Object> invoiceMap = new Map<String, Object>();
invoiceMap.put('InvoiceId','64');
invoiceMap.put('SendTo','[email protected]');
// Initialize the RequestJSON Data to be passed.
Map<String, Object> reqJSONMap = new Map<String, Object>();
reqJSONMap.put('sendinvoice' , invoiceMap);
String reqJSON = JSON.serialize(reqJSONMap);
Map<String, Object> finalReqMap = new Map<String, Object>();
finalReqMap.put('version' , '1.0');
finalReqMap.put('action' , 'sendinvoice');
finalReqMap.put('RequestJSON' , reqJSON);
//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(respMap);