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

# Update invoice

PATCH https://api.md.tiankii.com/v1/payment-requests/billing-invoices/{id}
Content-Type: application/json

## Update invoice

Updates an invoice (`INVOICE` type) by `:id`. Accepts any subset of the create fields (all optional). The invoice must belong to the store resolved from the API key.

### Authentication
Merchant API key in `x-api-key`. Requires scope `Merchant.payment_link.update`. Optionally scope with `x-application-account-id`.

### Path parameters
- `id` — invoice (payment request) id.

### Body (application/json)
Partial invoice — any of: `amount`, `currency`, `title`, `frecuency`, `frecuencyData`, `customerId`, `invoiceNumber`, `invoiceDate`, `dueDate`, `salesTax`, `quantity`, `items[]`, `repeat`, `poNumber`, `memo`, `appId`.

Returns the updated invoice (BillingInvoiceResponseDto).

---
**Notas:** Handler: billingInvoicesService.update. Lifecycle/status changes use the shared /v1/payment-requests routes.

Reference: https://docs.tiankii.com/api-reference/tiankii-api-api-key/payment-requests/invoices/update

## Authentication

- `x-api-key` header (required)

## Request

### Path parameters

- `id` (string, required) — Id of the invoice (payment request).

### Headers

- `x-application-account-id` (string, optional) — Scope the request to a specific store / account instead of the one resolved from the API key. Aliases: the `x-account-id` header, or the `application_account_id` / `account_id` query parameter.

### Body (application/json)

- `dueDate` (datetime, optional)
- `salesTax` (integer, optional)
- `memo` (string, optional)

## Examples

**Request**

```json
{
  "dueDate": "2026-07-31T00:00:00Z",
  "salesTax": 25,
  "memo": "Updated terms — net 30."
}
```

**SDK Code**

```python
import requests

url = "https://api.md.tiankii.com/v1/payment-requests/billing-invoices/A1B2C3D4E5F6A1B2"

payload = {
    "dueDate": "2026-07-31T00:00:00Z",
    "salesTax": 25,
    "memo": "Updated terms — net 30."
}
headers = {
    "x-application-account-id": "acct_3f9a21c7",
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.md.tiankii.com/v1/payment-requests/billing-invoices/A1B2C3D4E5F6A1B2';
const options = {
  method: 'PATCH',
  headers: {
    'x-application-account-id': 'acct_3f9a21c7',
    'x-api-key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"dueDate":"2026-07-31T00:00:00Z","salesTax":25,"memo":"Updated terms — net 30."}'
};

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

```go
package main

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

func main() {

	url := "https://api.md.tiankii.com/v1/payment-requests/billing-invoices/A1B2C3D4E5F6A1B2"

	payload := strings.NewReader("{\n  \"dueDate\": \"2026-07-31T00:00:00Z\",\n  \"salesTax\": 25,\n  \"memo\": \"Updated terms — net 30.\"\n}")

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

	req.Header.Add("x-application-account-id", "acct_3f9a21c7")
	req.Header.Add("x-api-key", "<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
require 'uri'
require 'net/http'

url = URI("https://api.md.tiankii.com/v1/payment-requests/billing-invoices/A1B2C3D4E5F6A1B2")

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

request = Net::HTTP::Patch.new(url)
request["x-application-account-id"] = 'acct_3f9a21c7'
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"dueDate\": \"2026-07-31T00:00:00Z\",\n  \"salesTax\": 25,\n  \"memo\": \"Updated terms — net 30.\"\n}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.md.tiankii.com/v1/payment-requests/billing-invoices/A1B2C3D4E5F6A1B2")
  .header("x-application-account-id", "acct_3f9a21c7")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"dueDate\": \"2026-07-31T00:00:00Z\",\n  \"salesTax\": 25,\n  \"memo\": \"Updated terms — net 30.\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.md.tiankii.com/v1/payment-requests/billing-invoices/A1B2C3D4E5F6A1B2', [
  'body' => '{
  "dueDate": "2026-07-31T00:00:00Z",
  "salesTax": 25,
  "memo": "Updated terms — net 30."
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
    'x-application-account-id' => 'acct_3f9a21c7',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.md.tiankii.com/v1/payment-requests/billing-invoices/A1B2C3D4E5F6A1B2");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-application-account-id", "acct_3f9a21c7");
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"dueDate\": \"2026-07-31T00:00:00Z\",\n  \"salesTax\": 25,\n  \"memo\": \"Updated terms — net 30.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-application-account-id": "acct_3f9a21c7",
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "dueDate": "2026-07-31T00:00:00Z",
  "salesTax": 25,
  "memo": "Updated terms — net 30."
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.md.tiankii.com/v1/payment-requests/billing-invoices/A1B2C3D4E5F6A1B2")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```