Change Status
2 min
The following is an example of a request to change the status of an invoice. The invoice_id, invoiceStatus, and processorId are required to update the invoice status.
Field Name | Data Type | Description |
|---|---|---|
invoice_id* | String | Id of the Invoice in your connected processor. |
invoiceStatus* | String | You can change the Status of an Open Invoice to Paid, Void, or Uncollectible by sending values of invoiceStatus as pay, void, or mark_uncollectible, respectively. |
processorId* | String | Account Id of the connected Processor |
Note: You can only update one record at a time
The response returns the Invoice information, which we see in our example.
// Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('invoice_id', 'invoice_id');
// invoiceStatus = mark_uncollectible or void or pay
requestJSONMap.put('invoiceStatus', 'invoiceStatus');
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version','1.0');
reqObj.put('action','ChangeInvoiceStatus');
reqObj.put('processorId', 'processorId');
reqObj.put('requestJSON',reqJSON);
// Placing a request to Breadwinner Global API
Map<String,Object> resp = bw_payments.BreadwinnerPaymentsAPI.call(reqObj);
System.debug(resp);