> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Update Invoice

PUT https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/{invoiceId}
Content-Type: application/json

update an invoice

Reference: https://docs.bigcommerce.com/developer/api-reference/rest/b2b/management/invoice-management/invoice/put-invoices-invoice-id

## Authentication

- `X-Auth-Token` header (required) — | Header | Argument | Description | |:-------|:---------|:------------| | `X-Auth-Token` | `access_token` | For more about API accounts that generate `access_token`s, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts). | For example requests and more information about authenticating BigCommerce APIs, see [Authentication and Example Requests](/developer/docs/overview/api-fundamentals/api-accounts#x-auth-token-header-example-requests). For more about BigCommerce OAuth scopes, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#oauth-scopes). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).
- `X-Store-Hash` header (required) — | Header | Argument | Description | |:-------|:---------|:------------| | `X-Store-Hash` | `store_hash` | The unique store hash associated with a BigCommerce store that has B2B Edition enabled. |

## Request

### Path parameters

- `invoiceId` (string, required) — invoice id

### Body (application/json)

This endpoint expects an object.

- `customerId` (string, optional) — B2B Edition Company ID
- `externalCustomerId` (string, optional) — Ext Customer ID
- `externalId` (string, optional) — Ext Invoice ID
- `invoiceNumber` (string, optional) — Invoice Number, must be unique
- `type` (string, optional)
- `dueDate` (double, optional) — Invoice due date
- `status` (double, optional) — invoice status, noted status will be auto set to 2 when open balance is \<= 0
- `purchaseOrderNumber` (string, optional) — PO Number
- `details` (InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetails, optional) — Details that will show on the invoice. When updating this field, the new value will completely replace the existing details. To preserve existing details while making updates, retrieve the current details first, and make your edits to that object before submitting the changes.
- `source` (double, optional) — Mark the source of the invoice, 0 for B2B Edition, 1 for external.
- `originalBalance` (InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaOriginalBalance, optional) — Invoice original balance
- `openBalance` (InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaOpenBalance, optional) — Invoice balance awaiting for payment
- `createdAt` (integer, optional)
- `externalPdfUrl` (string, optional) — The URL of an externally hosted PDF file to be associated with this invoice. The file size must not exceed 5 MB. Ensure that the file hosting service supports Cross-Origin Resource Sharing (CORS) to allow our system to access the file. To remove an existing PDF link, use an empty string.
- `extraFields` (list of InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaExtraFieldsItems, optional)

## Response

### 200

OK

- `code` (double, required)
- `data` (InvoicesInvoiceIdPutResponsesContentApplicationJsonSchemaData, required)
- `meta` (InvoicesInvoiceIdPutResponsesContentApplicationJsonSchemaMeta, required)

## Types

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetails

Details that will show on the invoice. When updating this field, the new value will completely replace the existing details. To preserve existing details while making updates, retrieve the current details first, and make your edits to that object before submitting the changes.

- `header` (InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsHeader, optional)
- `details` (InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetails, optional)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaOriginalBalance

Invoice original balance

- `code` (string, required)
- `value` (string, required)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaOpenBalance

Invoice balance awaiting for payment

- `code` (string, required)
- `value` (string, required)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaExtraFieldsItems

- `fieldName` (string, required) — Field name that config in you store
- `fieldValue` (string, required) — Value of the extra field.

### InvoicesInvoiceIdPutResponsesContentApplicationJsonSchemaData

- `id` (double, required) — Invoice ID

### InvoicesInvoiceIdPutResponsesContentApplicationJsonSchemaMeta

- `message` (string, required)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsHeader

- `costLines` (list of InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsHeaderCostLinesItems, optional)
- `billingAddress` (InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsHeaderBillingAddress, optional)
- `shippingAddresses` (list of InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsHeaderShippingAddressesItems, optional)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetails

- `shipments` (list of InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetailsShipmentsItems, optional)
- `lineItems` (list of InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetailsLineItemsItems, optional)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsHeaderCostLinesItems

- `amount` (InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsHeaderCostLinesItemsAmount, required)
- `description` (string, required)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsHeaderBillingAddress

- `city` (string, required)
- `state` (string, required)
- `country` (string, required)
- `street1` (string, required)
- `street2` (string, required)
- `zipCode` (string, required)
- `lastName` (string, required)
- `firstName` (string, required)
- `customFields` (string, required)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsHeaderShippingAddressesItems

- `city` (string, required)
- `state` (string, required)
- `country` (string, required)
- `street1` (string, required)
- `street2` (string, required)
- `zipCode` (string, required)
- `lastName` (string, required)
- `firstName` (string, required)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetailsShipmentsItems

- `addressIndex` (string, required)
- `shipDate` (string, required)
- `shipVia` (string, required)
- `trackingNumber` (string, required)
- `comments` (string, required)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetailsLineItemsItems

- `sku` (string, required)
- `quantity` (string, required)
- `unitPrice` (InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetailsLineItemsItemsUnitPrice, required)
- `type` (string, optional)
- `comments` (string, optional)
- `description` (string, optional) — Product description or product name. This field is required for custom product.
- `customFields` (InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetailsLineItemsItemsCustomFields, optional) — Adds custom information to the product.
- `unitDiscount` (InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetailsLineItemsItemsUnitDiscount, optional)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsHeaderCostLinesItemsAmount

- `code` (string, required)
- `value` (string, required)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetailsLineItemsItemsUnitPrice

- `code` (string, required)
- `value` (string, required)

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetailsLineItemsItemsCustomFields

Adds custom information to the product.

- `key` (string, optional) — The custom field name.
- `value` (string, optional) — The custom field value.

### InvoicesInvoiceIdPutRequestBodyContentApplicationJsonSchemaDetailsDetailsLineItemsItemsUnitDiscount

- `code` (string, required)
- `value` (string, required)

## Examples

### Update an invoice

**Request**

```json
{
  "customerId": "3",
  "dueDate": 1619826907,
  "details": {
    "header": {
      "costLines": [
        {
          "amount": {
            "code": "USD",
            "value": "400.0000"
          },
          "description": "Subtotal"
        },
        {
          "amount": {
            "code": "USD",
            "value": "0.0000"
          },
          "description": "Freight"
        },
        {
          "amount": {
            "code": "USD",
            "value": "0.0000"
          },
          "description": "Sales Tax"
        }
      ]
    },
    "details": {
      "lineItems": [
        {
          "sku": "CLC",
          "quantity": "2",
          "unitPrice": {
            "code": "USD",
            "value": "200.0000"
          },
          "type": "physical",
          "comments": "item comments",
          "description": "[Sample] Canvas Laundry Cart",
          "customFields": {
            "key": "Back-ordered",
            "value": "No"
          }
        }
      ]
    }
  },
  "openBalance": {
    "code": "USD",
    "value": "12.0000"
  }
}
```

**Response**

```json
{
  "code": 200,
  "data": {
    "id": 33
  },
  "meta": {
    "message": "SUCCESS"
  }
}
```

**SDK Code**

```python Update an invoice
import requests

url = "https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId"

payload = {
    "customerId": "3",
    "dueDate": 1619826907,
    "details": {
        "header": { "costLines": [
                {
                    "amount": {
                        "code": "USD",
                        "value": "400.0000"
                    },
                    "description": "Subtotal"
                },
                {
                    "amount": {
                        "code": "USD",
                        "value": "0.0000"
                    },
                    "description": "Freight"
                },
                {
                    "amount": {
                        "code": "USD",
                        "value": "0.0000"
                    },
                    "description": "Sales Tax"
                }
            ] },
        "details": { "lineItems": [
                {
                    "sku": "CLC",
                    "quantity": "2",
                    "unitPrice": {
                        "code": "USD",
                        "value": "200.0000"
                    },
                    "type": "physical",
                    "comments": "item comments",
                    "description": "[Sample] Canvas Laundry Cart",
                    "customFields": {
                        "key": "Back-ordered",
                        "value": "No"
                    }
                }
            ] }
    },
    "openBalance": {
        "code": "USD",
        "value": "12.0000"
    }
}
headers = {
    "X-Auth-Token": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Update an invoice
const url = 'https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId';
const options = {
  method: 'PUT',
  headers: {'X-Auth-Token': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"customerId":"3","dueDate":1619826907,"details":{"header":{"costLines":[{"amount":{"code":"USD","value":"400.0000"},"description":"Subtotal"},{"amount":{"code":"USD","value":"0.0000"},"description":"Freight"},{"amount":{"code":"USD","value":"0.0000"},"description":"Sales Tax"}]},"details":{"lineItems":[{"sku":"CLC","quantity":"2","unitPrice":{"code":"USD","value":"200.0000"},"type":"physical","comments":"item comments","description":"[Sample] Canvas Laundry Cart","customFields":{"key":"Back-ordered","value":"No"}}]}},"openBalance":{"code":"USD","value":"12.0000"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Update an invoice
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId"

	payload := strings.NewReader("{\n  \"customerId\": \"3\",\n  \"dueDate\": 1619826907,\n  \"details\": {\n    \"header\": {\n      \"costLines\": [\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"400.0000\"\n          },\n          \"description\": \"Subtotal\"\n        },\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"0.0000\"\n          },\n          \"description\": \"Freight\"\n        },\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"0.0000\"\n          },\n          \"description\": \"Sales Tax\"\n        }\n      ]\n    },\n    \"details\": {\n      \"lineItems\": [\n        {\n          \"sku\": \"CLC\",\n          \"quantity\": \"2\",\n          \"unitPrice\": {\n            \"code\": \"USD\",\n            \"value\": \"200.0000\"\n          },\n          \"type\": \"physical\",\n          \"comments\": \"item comments\",\n          \"description\": \"[Sample] Canvas Laundry Cart\",\n          \"customFields\": {\n            \"key\": \"Back-ordered\",\n            \"value\": \"No\"\n          }\n        }\n      ]\n    }\n  },\n  \"openBalance\": {\n    \"code\": \"USD\",\n    \"value\": \"12.0000\"\n  }\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("X-Auth-Token", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Update an invoice
require 'uri'
require 'net/http'

url = URI("https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-Auth-Token"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"customerId\": \"3\",\n  \"dueDate\": 1619826907,\n  \"details\": {\n    \"header\": {\n      \"costLines\": [\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"400.0000\"\n          },\n          \"description\": \"Subtotal\"\n        },\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"0.0000\"\n          },\n          \"description\": \"Freight\"\n        },\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"0.0000\"\n          },\n          \"description\": \"Sales Tax\"\n        }\n      ]\n    },\n    \"details\": {\n      \"lineItems\": [\n        {\n          \"sku\": \"CLC\",\n          \"quantity\": \"2\",\n          \"unitPrice\": {\n            \"code\": \"USD\",\n            \"value\": \"200.0000\"\n          },\n          \"type\": \"physical\",\n          \"comments\": \"item comments\",\n          \"description\": \"[Sample] Canvas Laundry Cart\",\n          \"customFields\": {\n            \"key\": \"Back-ordered\",\n            \"value\": \"No\"\n          }\n        }\n      ]\n    }\n  },\n  \"openBalance\": {\n    \"code\": \"USD\",\n    \"value\": \"12.0000\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Update an invoice
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId")
  .header("X-Auth-Token", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"customerId\": \"3\",\n  \"dueDate\": 1619826907,\n  \"details\": {\n    \"header\": {\n      \"costLines\": [\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"400.0000\"\n          },\n          \"description\": \"Subtotal\"\n        },\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"0.0000\"\n          },\n          \"description\": \"Freight\"\n        },\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"0.0000\"\n          },\n          \"description\": \"Sales Tax\"\n        }\n      ]\n    },\n    \"details\": {\n      \"lineItems\": [\n        {\n          \"sku\": \"CLC\",\n          \"quantity\": \"2\",\n          \"unitPrice\": {\n            \"code\": \"USD\",\n            \"value\": \"200.0000\"\n          },\n          \"type\": \"physical\",\n          \"comments\": \"item comments\",\n          \"description\": \"[Sample] Canvas Laundry Cart\",\n          \"customFields\": {\n            \"key\": \"Back-ordered\",\n            \"value\": \"No\"\n          }\n        }\n      ]\n    }\n  },\n  \"openBalance\": {\n    \"code\": \"USD\",\n    \"value\": \"12.0000\"\n  }\n}")
  .asString();
```

```php Update an invoice
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId', [
  'body' => '{
  "customerId": "3",
  "dueDate": 1619826907,
  "details": {
    "header": {
      "costLines": [
        {
          "amount": {
            "code": "USD",
            "value": "400.0000"
          },
          "description": "Subtotal"
        },
        {
          "amount": {
            "code": "USD",
            "value": "0.0000"
          },
          "description": "Freight"
        },
        {
          "amount": {
            "code": "USD",
            "value": "0.0000"
          },
          "description": "Sales Tax"
        }
      ]
    },
    "details": {
      "lineItems": [
        {
          "sku": "CLC",
          "quantity": "2",
          "unitPrice": {
            "code": "USD",
            "value": "200.0000"
          },
          "type": "physical",
          "comments": "item comments",
          "description": "[Sample] Canvas Laundry Cart",
          "customFields": {
            "key": "Back-ordered",
            "value": "No"
          }
        }
      ]
    }
  },
  "openBalance": {
    "code": "USD",
    "value": "12.0000"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Auth-Token' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Update an invoice
using RestSharp;

var client = new RestClient("https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId");
var request = new RestRequest(Method.PUT);
request.AddHeader("X-Auth-Token", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"customerId\": \"3\",\n  \"dueDate\": 1619826907,\n  \"details\": {\n    \"header\": {\n      \"costLines\": [\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"400.0000\"\n          },\n          \"description\": \"Subtotal\"\n        },\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"0.0000\"\n          },\n          \"description\": \"Freight\"\n        },\n        {\n          \"amount\": {\n            \"code\": \"USD\",\n            \"value\": \"0.0000\"\n          },\n          \"description\": \"Sales Tax\"\n        }\n      ]\n    },\n    \"details\": {\n      \"lineItems\": [\n        {\n          \"sku\": \"CLC\",\n          \"quantity\": \"2\",\n          \"unitPrice\": {\n            \"code\": \"USD\",\n            \"value\": \"200.0000\"\n          },\n          \"type\": \"physical\",\n          \"comments\": \"item comments\",\n          \"description\": \"[Sample] Canvas Laundry Cart\",\n          \"customFields\": {\n            \"key\": \"Back-ordered\",\n            \"value\": \"No\"\n          }\n        }\n      ]\n    }\n  },\n  \"openBalance\": {\n    \"code\": \"USD\",\n    \"value\": \"12.0000\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update an invoice
import Foundation

let headers = [
  "X-Auth-Token": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "customerId": "3",
  "dueDate": 1619826907,
  "details": [
    "header": ["costLines": [
        [
          "amount": [
            "code": "USD",
            "value": "400.0000"
          ],
          "description": "Subtotal"
        ],
        [
          "amount": [
            "code": "USD",
            "value": "0.0000"
          ],
          "description": "Freight"
        ],
        [
          "amount": [
            "code": "USD",
            "value": "0.0000"
          ],
          "description": "Sales Tax"
        ]
      ]],
    "details": ["lineItems": [
        [
          "sku": "CLC",
          "quantity": "2",
          "unitPrice": [
            "code": "USD",
            "value": "200.0000"
          ],
          "type": "physical",
          "comments": "item comments",
          "description": "[Sample] Canvas Laundry Cart",
          "customFields": [
            "key": "Back-ordered",
            "value": "No"
          ]
        ]
      ]]
  ],
  "openBalance": [
    "code": "USD",
    "value": "12.0000"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Invalid invoice update

**Request**

```json
{
  "openBalance": {
    "code": "USD",
    "value": "12.0000"
  }
}
```

**Response**

```json
{
  "code": 400,
  "data": {
    "id": 33
  },
  "meta": {
    "message": "Bad Requests Error",
    "errors": "Please enter a valid number; "
  }
}
```

**SDK Code**

```python Invalid invoice update
import requests

url = "https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId"

payload = { "openBalance": {
        "code": "USD",
        "value": "12.0000"
    } }
headers = {
    "X-Auth-Token": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Invalid invoice update
const url = 'https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId';
const options = {
  method: 'PUT',
  headers: {'X-Auth-Token': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"openBalance":{"code":"USD","value":"12.0000"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Invalid invoice update
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId"

	payload := strings.NewReader("{\n  \"openBalance\": {\n    \"code\": \"USD\",\n    \"value\": \"12.0000\"\n  }\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("X-Auth-Token", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Invalid invoice update
require 'uri'
require 'net/http'

url = URI("https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-Auth-Token"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"openBalance\": {\n    \"code\": \"USD\",\n    \"value\": \"12.0000\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Invalid invoice update
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId")
  .header("X-Auth-Token", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"openBalance\": {\n    \"code\": \"USD\",\n    \"value\": \"12.0000\"\n  }\n}")
  .asString();
```

```php Invalid invoice update
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId', [
  'body' => '{
  "openBalance": {
    "code": "USD",
    "value": "12.0000"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Auth-Token' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Invalid invoice update
using RestSharp;

var client = new RestClient("https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId");
var request = new RestRequest(Method.PUT);
request.AddHeader("X-Auth-Token", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"openBalance\": {\n    \"code\": \"USD\",\n    \"value\": \"12.0000\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Invalid invoice update
import Foundation

let headers = [
  "X-Auth-Token": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["openBalance": [
    "code": "USD",
    "value": "12.0000"
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-b2b.bigcommerce.com/api/v3/io/ip/invoices/invoiceId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```