> 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.

# Create invoice

POST https://api.md.tiankii.com/v1/payment-requests/billing-invoices
Content-Type: application/json

## Create invoice

Creates an **invoice** — a payment request of type `INVOICE`. An invoice is a bill you issue to a customer (line items, quantity, sales tax, issue/due dates, PO number, memo). When the customer decides to pay it, the API generates a **checkout invoice** for the amount.

The record is stored as a `PaymentRequests` row with `Type = INVOICE`; fields beyond the shared base are kept in the request's JSON `Data` blob and returned via the presenter. The store is resolved from the API key (`user.store_id`); you do not pass a store id.

### Authentication

* Merchant API key in `x-api-key` (alias `x-account-api-key`).
* Requires scope `Merchant.payment_link.create`.
* Optionally scope with `x-application-account-id` (alias `x-account-id`) or the `application_account_id` / `account_id` query param.

### Body (application/json)

Required (shared base): `amount`, `currency`, `title`, `frecuency` (`ONE_TIME` | `MULTIPLE` | `RECURRING`; `frecuencyData` JSON string required when `RECURRING`).
Invoice-specific (all optional): `customerId` (the billed customer), `invoiceNumber`, `invoiceDate`, `dueDate`, `salesTax`, `quantity` (min 1, when there is no itemized list), `items[]` (`{ productId, itemName, quantity, price }` — all four are required inside each item), `repeat`, `poNumber`, `memo`. `appId` optionally links a sale terminal (app).

Returns the created invoice (BillingInvoiceResponseDto).

***

**Notas:** Handler: billingInvoicesService.create. Type-agnostic operations (find, pay, activate, archive, complete, delete) use the shared /v1/payment-requests routes. Not to be confused with /v1/invoice (checkout invoices).

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

## Authentication

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

## 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)

- `amount` (double, required)
- `currency` (string, required)
- `title` (string, required)
- `frecuency` (string, required) — ONE_TIME | MULTIPLE | RECURRING. `frecuencyData` (JSON string) becomes required when RECURRING.

## Examples

**Request**

```json
{
  "amount": 1.5,
  "currency": "USD",
  "title": "Invoice #1043 — Consulting services",
  "frecuency": "ONE_TIME"
}
```

**SDK Code**

```python
import requests

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

payload = {
    "amount": 1.5,
    "currency": "USD",
    "title": "Invoice #1043 — Consulting services",
    "frecuency": "ONE_TIME"
}
headers = {
    "x-application-account-id": "acct_3f9a21c7",
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.md.tiankii.com/v1/payment-requests/billing-invoices';
const options = {
  method: 'POST',
  headers: {
    'x-application-account-id': 'acct_3f9a21c7',
    'x-api-key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"amount":1.5,"currency":"USD","title":"Invoice #1043 — Consulting services","frecuency":"ONE_TIME"}'
};

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"

	payload := strings.NewReader("{\n  \"amount\": 1.5,\n  \"currency\": \"USD\",\n  \"title\": \"Invoice #1043 — Consulting services\",\n  \"frecuency\": \"ONE_TIME\"\n}")

	req, _ := http.NewRequest("POST", 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")

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

request = Net::HTTP::Post.new(url)
request["x-application-account-id"] = 'acct_3f9a21c7'
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": 1.5,\n  \"currency\": \"USD\",\n  \"title\": \"Invoice #1043 — Consulting services\",\n  \"frecuency\": \"ONE_TIME\"\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.post("https://api.md.tiankii.com/v1/payment-requests/billing-invoices")
  .header("x-application-account-id", "acct_3f9a21c7")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": 1.5,\n  \"currency\": \"USD\",\n  \"title\": \"Invoice #1043 — Consulting services\",\n  \"frecuency\": \"ONE_TIME\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.md.tiankii.com/v1/payment-requests/billing-invoices', [
  'body' => '{
  "amount": 1.5,
  "currency": "USD",
  "title": "Invoice #1043 — Consulting services",
  "frecuency": "ONE_TIME"
}',
  '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");
var request = new RestRequest(Method.POST);
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  \"amount\": 1.5,\n  \"currency\": \"USD\",\n  \"title\": \"Invoice #1043 — Consulting services\",\n  \"frecuency\": \"ONE_TIME\"\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 = [
  "amount": 1.5,
  "currency": "USD",
  "title": "Invoice #1043 — Consulting services",
  "frecuency": "ONE_TIME"
] 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")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```