curl --request PATCH \
--url https://api.fintoc.com/v2/invoices/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"order_id": "1234"
}
}
'import requests
url = "https://api.fintoc.com/v2/invoices/{id}"
payload = { "metadata": { "order_id": "1234" } }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({metadata: {order_id: '1234'}})
};
fetch('https://api.fintoc.com/v2/invoices/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fintoc.com/v2/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
'order_id' => '1234'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fintoc.com/v2/invoices/{id}"
payload := strings.NewReader("{\n \"metadata\": {\n \"order_id\": \"1234\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.fintoc.com/v2/invoices/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"order_id\": \"1234\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fintoc.com/v2/invoices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"order_id\": \"1234\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe",
"object": "invoice",
"attempt_count": 0,
"collection_method": "charge_automatically",
"created_at": "2026-05-01T12:00:00Z",
"currency": "CLP",
"customer": "cus_2bVdWyTnGq4PfLs7DkXjRm0CwIo",
"default_payment_method": "pm_2bVdX3StMv9UkQxCIpCoWr5H1Nt",
"hosted_invoice_url": "https://acme.billing.fintoc.com/invoices/inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe",
"lines": [
{
"id": "il_2bVdX0PqJs6RhNu9FmZlTo2EyKq",
"object": "line_item",
"name": "Premium Plan",
"description": "A premium plan",
"amount": 30000,
"currency": "CLP",
"period_end": "2026-06-01T00:00:00Z",
"period_start": "2026-05-01T00:00:00Z",
"quantity": 1
}
],
"metadata": {
"order_id": "1234"
},
"mode": "live",
"next_payment_attempt_at": null,
"payments": [],
"status": "open",
"subscription": "sub_2bVdWzKfHr5QgMt8ElYkSn1DxJp",
"total": 30000
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_metadata",
"param": "metadata",
"message": "Array values not permitted in Metadata",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid API Key: invalid-*oken"
}
}{
"error": {
"type": "invalid_request_error",
"code": "missing_resource",
"param": "id",
"message": "No such invoice: inv_fake_id",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}Update an invoice
Updates the metadata of the invoice with the given id. This is the only attribute you can change, and you can change it at any point in the invoice’s lifecycle, including after it is paid or voided. When metadata is provided, it replaces the entire existing metadata object. If you omit it, the invoice keeps its current metadata. The invoice must belong to your organization and to the live or test mode of the API key used.
curl --request PATCH \
--url https://api.fintoc.com/v2/invoices/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"order_id": "1234"
}
}
'import requests
url = "https://api.fintoc.com/v2/invoices/{id}"
payload = { "metadata": { "order_id": "1234" } }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({metadata: {order_id: '1234'}})
};
fetch('https://api.fintoc.com/v2/invoices/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fintoc.com/v2/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
'order_id' => '1234'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fintoc.com/v2/invoices/{id}"
payload := strings.NewReader("{\n \"metadata\": {\n \"order_id\": \"1234\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.fintoc.com/v2/invoices/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"order_id\": \"1234\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fintoc.com/v2/invoices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"order_id\": \"1234\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe",
"object": "invoice",
"attempt_count": 0,
"collection_method": "charge_automatically",
"created_at": "2026-05-01T12:00:00Z",
"currency": "CLP",
"customer": "cus_2bVdWyTnGq4PfLs7DkXjRm0CwIo",
"default_payment_method": "pm_2bVdX3StMv9UkQxCIpCoWr5H1Nt",
"hosted_invoice_url": "https://acme.billing.fintoc.com/invoices/inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe",
"lines": [
{
"id": "il_2bVdX0PqJs6RhNu9FmZlTo2EyKq",
"object": "line_item",
"name": "Premium Plan",
"description": "A premium plan",
"amount": 30000,
"currency": "CLP",
"period_end": "2026-06-01T00:00:00Z",
"period_start": "2026-05-01T00:00:00Z",
"quantity": 1
}
],
"metadata": {
"order_id": "1234"
},
"mode": "live",
"next_payment_attempt_at": null,
"payments": [],
"status": "open",
"subscription": "sub_2bVdWzKfHr5QgMt8ElYkSn1DxJp",
"total": 30000
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_metadata",
"param": "metadata",
"message": "Array values not permitted in Metadata",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid API Key: invalid-*oken"
}
}{
"error": {
"type": "invalid_request_error",
"code": "missing_resource",
"param": "id",
"message": "No such invoice: inv_fake_id",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}Authorizations
Path Parameters
Unique identifier of the invoice to update.
Body
Set of key-value pairs to attach to the invoice, useful for storing additional structured information. Up to 50 keys, with key names up to 40 characters and string values up to 500 characters. Sending metadata replaces the entire existing object.
{ "order_id": "1234" }
Response
The updated invoice, including its line items and payments.
Unique identifier of the invoice. null on the preview invoice carried by an invoice.upcoming event, since Fintoc has not created that invoice yet.
"inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe"
Type of the object. Always invoice.
Number of automatic charge attempts Fintoc has made on the invoice. 0 until the invoice is finalized and charged for the first time.
1
The way Fintoc collects the invoice. charge_automatically means Fintoc charges default_payment_method once the invoice is finalized. send_invoice means Fintoc leaves the invoice open for you to collect, through hosted_invoice_url or outside Fintoc. Subscription invoices inherit the collection method when issued and keep that collection method even if the subscription changes later.
charge_automatically, send_invoice "send_invoice"
ISO 8601 timestamp of when the invoice was created. null on the preview invoice carried by an invoice.upcoming event, since that invoice does not exist yet.
"2026-05-01T12:00:00Z"
Currency of the invoice, as an ISO 4217 code. Every line item uses this currency.
CLP, MXN "CLP"
id of the customer the invoice bills.
"cus_2bVdWyTnGq4PfLs7DkXjRm0CwIo"
id of the payment method Fintoc charges when the invoice is finalized. null for invoices without one, such as subscription invoices.
"pm_2c4mDhAbCdEfGhIjKlMnOpQrStu"
Whether the invoice was settled with a payment collected outside Fintoc. false for invoices Fintoc collected, and for invoices that are not yet paid.
false
URL of the hosted invoice page, where your customer can view and pay the invoice. null for invoices that are not open. In test mode, the URL points to the test mode portal.
"https://acme.billing.fintoc.com/invoices/inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe"
Line items that make up the invoice total.
Show child attributes
Show child attributes
Set of key-value pairs attached to the invoice. {} when the invoice has no metadata.
Mode of the invoice. live invoices use real data; test invoices use fake data for integration testing. An API key only sees invoices that share its mode.
live, test "live"
ISO 8601 timestamp of the next scheduled automatic charge attempt. null when no further attempt is scheduled. Also null on the preview invoice carried by an invoice.upcoming event, where lines[].period_start marks the charge date.
"2026-05-02T12:00:00Z"
Payment attempts to collect the invoice.
Show child attributes
Show child attributes
Status of the invoice. Invoices start as draft, become open when finalized, and end as paid or void. The preview invoice carried by an invoice.upcoming event reports draft and never appears when you list invoices.
draft, open, paid, void "draft"
id of the subscription the invoice belongs to. null for invoices not tied to a subscription.
"sub_2bVdWzKfHr5QgMt8ElYkSn1DxJp"
Total amount of the invoice, in the smallest unit of currency (for example, 30000 for $30000 CLP, since CLP has no minor unit, or 3000 for $30.00 MXN). Equals the sum of the line item amounts.
30000
Was this page helpful?