---
title: Change Status
slug: payments/change-status
description: Learn how to delete a draft invoice using Apex code in this informative document. Follow the provided example, which includes initializing a request JSON data map and specifying the invoice ID. Discover how to make a request to the Breadwinner Global API 
docTags: 
createdAt: 2023-10-27T11:28:43.510Z
---

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<font color="#eb144c">*</font>   | String        | Id of the Invoice in your connected processor.                                                                                                                                                                            |
| invoiceStatus<font color="#eb144c">*</font> | String        | You can change the Status of an Open Invoice to **Paid,** **Void,&#x20;**&#x6F;r **Uncollectible&#x20;**&#x62;y sending values of invoiceStatus as **pay,** **void,** or **mark\_uncollectible,&#x20;**&#x72;espectively. |
| processorId<font color="#eb144c">*</font>   | String        | Account Id of the connected Processor                                                                                                                                                                                     |

:::hint{type="info"}
Note: You can only update one record at a time
:::

The response returns the Invoice information, which we see in our example.

:::CodeblockTabs
Request

```apex
// 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);
```

Response

```json
//Few Properties are omitted to concise the response
{
  "id": "in_1NdEroBL59w6bp4Kf125Khn1",
  "object": "invoice",
  "account_country": "US",
  "account_name": "Demo Account",
  "account_tax_ids": null,
  "amount_due": 400,
  ..
  ..
  "status": "paid",
  "status_transitions": {
    "finalized_at": 1691597053,
    "marked_uncollectible_at": 1699378236,
    "paid_at": 1699378330,
    "voided_at": null
  },
  ..
  ..
  "subtotal": 400,
  "subtotal_excluding_tax": 400,
  "tax": null,
  "tax_percent": null,
  "test_clock": null,
  "total": 400,
  "total_discount_amounts": [
  ],
  "total_excluding_tax": 400,
  "total_tax_amounts": [
  ],
  "transfer_data": null,
  "webhooks_delivered_at": 1691597052
}
```
:::

