Faturas
Atualizar um rascunho
Atualizar um rascunho.
Atualizar um rascunho
curl --request POST \
--url https://api.chargefy.io/v1/invoices/{id} \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"line_items": [
{}
],
"description": {},
"statement_descriptor": {},
"due_date": "<string>",
"days_until_due": 123,
"collection_method": "<string>",
"default_payment_method": {},
"payment_method_types": [
{}
],
"payment_settings": {},
"late_fee": {},
"interest": {},
"allow_late_payment": true,
"delivery": "<string>",
"reminder_before_due_days": 123,
"reminder_past_due_days": 123,
"metadata": {}
}
'import requests
url = "https://api.chargefy.io/v1/invoices/{id}"
payload = {
"amount": 123,
"line_items": [{}],
"description": {},
"statement_descriptor": {},
"due_date": "<string>",
"days_until_due": 123,
"collection_method": "<string>",
"default_payment_method": {},
"payment_method_types": [{}],
"payment_settings": {},
"late_fee": {},
"interest": {},
"allow_late_payment": True,
"delivery": "<string>",
"reminder_before_due_days": 123,
"reminder_past_due_days": 123,
"metadata": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
line_items: [{}],
description: {},
statement_descriptor: {},
due_date: '<string>',
days_until_due: 123,
collection_method: '<string>',
default_payment_method: {},
payment_method_types: [{}],
payment_settings: {},
late_fee: {},
interest: {},
allow_late_payment: true,
delivery: '<string>',
reminder_before_due_days: 123,
reminder_past_due_days: 123,
metadata: {}
})
};
fetch('https://api.chargefy.io/v1/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.chargefy.io/v1/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'line_items' => [
[
]
],
'description' => [
],
'statement_descriptor' => [
],
'due_date' => '<string>',
'days_until_due' => 123,
'collection_method' => '<string>',
'default_payment_method' => [
],
'payment_method_types' => [
[
]
],
'payment_settings' => [
],
'late_fee' => [
],
'interest' => [
],
'allow_late_payment' => true,
'delivery' => '<string>',
'reminder_before_due_days' => 123,
'reminder_past_due_days' => 123,
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.chargefy.io/v1/invoices/{id}"
payload := strings.NewReader("{\n \"amount\": 123,\n \"line_items\": [\n {}\n ],\n \"description\": {},\n \"statement_descriptor\": {},\n \"due_date\": \"<string>\",\n \"days_until_due\": 123,\n \"collection_method\": \"<string>\",\n \"default_payment_method\": {},\n \"payment_method_types\": [\n {}\n ],\n \"payment_settings\": {},\n \"late_fee\": {},\n \"interest\": {},\n \"allow_late_payment\": true,\n \"delivery\": \"<string>\",\n \"reminder_before_due_days\": 123,\n \"reminder_past_due_days\": 123,\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.chargefy.io/v1/invoices/{id}")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"line_items\": [\n {}\n ],\n \"description\": {},\n \"statement_descriptor\": {},\n \"due_date\": \"<string>\",\n \"days_until_due\": 123,\n \"collection_method\": \"<string>\",\n \"default_payment_method\": {},\n \"payment_method_types\": [\n {}\n ],\n \"payment_settings\": {},\n \"late_fee\": {},\n \"interest\": {},\n \"allow_late_payment\": true,\n \"delivery\": \"<string>\",\n \"reminder_before_due_days\": 123,\n \"reminder_past_due_days\": 123,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chargefy.io/v1/invoices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"line_items\": [\n {}\n ],\n \"description\": {},\n \"statement_descriptor\": {},\n \"due_date\": \"<string>\",\n \"days_until_due\": 123,\n \"collection_method\": \"<string>\",\n \"default_payment_method\": {},\n \"payment_method_types\": [\n {}\n ],\n \"payment_settings\": {},\n \"late_fee\": {},\n \"interest\": {},\n \"allow_late_payment\": true,\n \"delivery\": \"<string>\",\n \"reminder_before_due_days\": 123,\n \"reminder_past_due_days\": 123,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "inv_ztXkaV1WLnrmCafN",
"object": "invoice",
"affiliates": [],
"allow_late_payment": true,
"amount_credit_balance_applied": 0,
"amount_discount": 0,
"amount_due": 12990,
"amount_due_now": 12990,
"amount_paid": 0,
"amount_remaining": 12990,
"amount_subtotal": 12990,
"amount_tax": 0,
"amount_total": 12990,
"attempt_count": 0,
"billing_reason": "manual",
"collection_method": "send_invoice",
"created_at": "2026-05-19T18:00:00Z",
"currency": "brl",
"customer": "cus_9KaTnfYPTCwvFLAd",
"customer_billing_address": null,
"customer_billing_name": null,
"customer_document": null,
"customer_document_type": null,
"customer_email": null,
"customer_name": null,
"default_payment_method": null,
"description": "Mensalidade de junho",
"due_date": "2026-06-10T12:00:00Z",
"ending_balance": 0,
"finalized_at": null,
"hosted_invoice_url": null,
"interest": {
"percent_per_month": 1
},
"interest_amount": null,
"invoice_pdf_url": null,
"late_fee": {
"type": "percentage",
"value": 2
},
"late_fee_amount": null,
"latest_charge": null,
"line_items": [
{
"id": "ili_GyVv5CghtCEFZTQj",
"object": "invoice_line_item",
"amount_discount": 0,
"amount_subtotal": 12990,
"amount_tax": 0,
"amount_total": 12990,
"currency": "brl",
"description": "Mensalidade de junho",
"discountable": true,
"metadata": {},
"period_end": null,
"period_start": null,
"position": 0,
"price": null,
"price_data": {
"currency": "brl",
"unit_amount": 12990
},
"product": null,
"proration": false,
"proration_details": {},
"quantity": 1,
"recurring_interval": null,
"recurring_interval_count": null,
"subscription_item": null,
"unit_amount": 12990
}
],
"livemode": true,
"marked_uncollectible_at": null,
"metadata": {},
"next_payment_attempt": null,
"number": null,
"paid_at": null,
"paid_out_of_band": false,
"payment_intent": null,
"payment_method_types": [
"pix",
"boleto",
"credit_card"
],
"payment_settings": {
"payment_method_options": null
},
"starting_balance": 0,
"statement_descriptor": "MENSALIDADE",
"status": "draft",
"subscription": null,
"surcharge_amount": 0,
"updated_at": "2026-05-19T18:00:00Z",
"voided_at": null
}
Edita somente uma invoice
draft. Os campos ausentes são preservados. Não é possível trocar cliente, moeda ou assinatura. Uma invoice já finalizada retorna 409.
A API recalcula os totais a partir dos itens no salvamento. A edição não cria pagamento, link público ou e-mail. Para períodos de assinatura ambíguos, novos itens são recusados; os itens existentes podem ser enviados com seu id, preservando período, vínculo e prorrata.
string
obrigatório
ID da invoice (
inv_*).integer
Valor em centavos, inclusive zero. Alternativa a
line_items.array
Substitui todos os itens. Usa o mesmo formato da criação. Em um item existente, envie
id para preservar seu período e vínculo com a assinatura. Não envie amount junto.string | null
Descrição da cobrança.
string | null
Identificador que aparecerá na cobrança.
string
Vencimento em ISO 8601.
integer
Prazo em dias, como alternativa a
due_date.string
send_invoice ou charge_automatically. O segundo exige uma assinatura.string | null
Método do mesmo cliente e organização.
array
Métodos permitidos:
pix, boleto, credit_card. Pelo menos um.object
Mesmo contrato de parcelamento das assinaturas:
payment_method_options.credit_card.installments.plan com type: "fixed_count", interval: "month" e count de 2 até o limite configurado (máximo 12). O principal deve comportar pelo menos R$ 7,00 por parcela. Envie payment_method_options.credit_card: null para remover o plano fixo.object | null
Multa no mesmo formato da criação;
null desliga.object | null
Juros no mesmo formato da criação;
null desliga.boolean
Permite pagamento após o vencimento.
string
chargefy envia e-mail e lembretes depois da finalização; manual deixa a entrega com você.integer
Dias antes do vencimento. Inteiro não negativo.
integer
Dias após o vencimento. Inteiro não negativo.
object
Metadados do integrador.
{
"id": "inv_ztXkaV1WLnrmCafN",
"object": "invoice",
"affiliates": [],
"allow_late_payment": true,
"amount_credit_balance_applied": 0,
"amount_discount": 0,
"amount_due": 12990,
"amount_due_now": 12990,
"amount_paid": 0,
"amount_remaining": 12990,
"amount_subtotal": 12990,
"amount_tax": 0,
"amount_total": 12990,
"attempt_count": 0,
"billing_reason": "manual",
"collection_method": "send_invoice",
"created_at": "2026-05-19T18:00:00Z",
"currency": "brl",
"customer": "cus_9KaTnfYPTCwvFLAd",
"customer_billing_address": null,
"customer_billing_name": null,
"customer_document": null,
"customer_document_type": null,
"customer_email": null,
"customer_name": null,
"default_payment_method": null,
"description": "Mensalidade de junho",
"due_date": "2026-06-10T12:00:00Z",
"ending_balance": 0,
"finalized_at": null,
"hosted_invoice_url": null,
"interest": {
"percent_per_month": 1
},
"interest_amount": null,
"invoice_pdf_url": null,
"late_fee": {
"type": "percentage",
"value": 2
},
"late_fee_amount": null,
"latest_charge": null,
"line_items": [
{
"id": "ili_GyVv5CghtCEFZTQj",
"object": "invoice_line_item",
"amount_discount": 0,
"amount_subtotal": 12990,
"amount_tax": 0,
"amount_total": 12990,
"currency": "brl",
"description": "Mensalidade de junho",
"discountable": true,
"metadata": {},
"period_end": null,
"period_start": null,
"position": 0,
"price": null,
"price_data": {
"currency": "brl",
"unit_amount": 12990
},
"product": null,
"proration": false,
"proration_details": {},
"quantity": 1,
"recurring_interval": null,
"recurring_interval_count": null,
"subscription_item": null,
"unit_amount": 12990
}
],
"livemode": true,
"marked_uncollectible_at": null,
"metadata": {},
"next_payment_attempt": null,
"number": null,
"paid_at": null,
"paid_out_of_band": false,
"payment_intent": null,
"payment_method_types": [
"pix",
"boleto",
"credit_card"
],
"payment_settings": {
"payment_method_options": null
},
"starting_balance": 0,
"statement_descriptor": "MENSALIDADE",
"status": "draft",
"subscription": null,
"surcharge_amount": 0,
"updated_at": "2026-05-19T18:00:00Z",
"voided_at": null
}
⌘I
Atualizar um rascunho
curl --request POST \
--url https://api.chargefy.io/v1/invoices/{id} \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"line_items": [
{}
],
"description": {},
"statement_descriptor": {},
"due_date": "<string>",
"days_until_due": 123,
"collection_method": "<string>",
"default_payment_method": {},
"payment_method_types": [
{}
],
"payment_settings": {},
"late_fee": {},
"interest": {},
"allow_late_payment": true,
"delivery": "<string>",
"reminder_before_due_days": 123,
"reminder_past_due_days": 123,
"metadata": {}
}
'import requests
url = "https://api.chargefy.io/v1/invoices/{id}"
payload = {
"amount": 123,
"line_items": [{}],
"description": {},
"statement_descriptor": {},
"due_date": "<string>",
"days_until_due": 123,
"collection_method": "<string>",
"default_payment_method": {},
"payment_method_types": [{}],
"payment_settings": {},
"late_fee": {},
"interest": {},
"allow_late_payment": True,
"delivery": "<string>",
"reminder_before_due_days": 123,
"reminder_past_due_days": 123,
"metadata": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
line_items: [{}],
description: {},
statement_descriptor: {},
due_date: '<string>',
days_until_due: 123,
collection_method: '<string>',
default_payment_method: {},
payment_method_types: [{}],
payment_settings: {},
late_fee: {},
interest: {},
allow_late_payment: true,
delivery: '<string>',
reminder_before_due_days: 123,
reminder_past_due_days: 123,
metadata: {}
})
};
fetch('https://api.chargefy.io/v1/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.chargefy.io/v1/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'line_items' => [
[
]
],
'description' => [
],
'statement_descriptor' => [
],
'due_date' => '<string>',
'days_until_due' => 123,
'collection_method' => '<string>',
'default_payment_method' => [
],
'payment_method_types' => [
[
]
],
'payment_settings' => [
],
'late_fee' => [
],
'interest' => [
],
'allow_late_payment' => true,
'delivery' => '<string>',
'reminder_before_due_days' => 123,
'reminder_past_due_days' => 123,
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.chargefy.io/v1/invoices/{id}"
payload := strings.NewReader("{\n \"amount\": 123,\n \"line_items\": [\n {}\n ],\n \"description\": {},\n \"statement_descriptor\": {},\n \"due_date\": \"<string>\",\n \"days_until_due\": 123,\n \"collection_method\": \"<string>\",\n \"default_payment_method\": {},\n \"payment_method_types\": [\n {}\n ],\n \"payment_settings\": {},\n \"late_fee\": {},\n \"interest\": {},\n \"allow_late_payment\": true,\n \"delivery\": \"<string>\",\n \"reminder_before_due_days\": 123,\n \"reminder_past_due_days\": 123,\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.chargefy.io/v1/invoices/{id}")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"line_items\": [\n {}\n ],\n \"description\": {},\n \"statement_descriptor\": {},\n \"due_date\": \"<string>\",\n \"days_until_due\": 123,\n \"collection_method\": \"<string>\",\n \"default_payment_method\": {},\n \"payment_method_types\": [\n {}\n ],\n \"payment_settings\": {},\n \"late_fee\": {},\n \"interest\": {},\n \"allow_late_payment\": true,\n \"delivery\": \"<string>\",\n \"reminder_before_due_days\": 123,\n \"reminder_past_due_days\": 123,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chargefy.io/v1/invoices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"line_items\": [\n {}\n ],\n \"description\": {},\n \"statement_descriptor\": {},\n \"due_date\": \"<string>\",\n \"days_until_due\": 123,\n \"collection_method\": \"<string>\",\n \"default_payment_method\": {},\n \"payment_method_types\": [\n {}\n ],\n \"payment_settings\": {},\n \"late_fee\": {},\n \"interest\": {},\n \"allow_late_payment\": true,\n \"delivery\": \"<string>\",\n \"reminder_before_due_days\": 123,\n \"reminder_past_due_days\": 123,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "inv_ztXkaV1WLnrmCafN",
"object": "invoice",
"affiliates": [],
"allow_late_payment": true,
"amount_credit_balance_applied": 0,
"amount_discount": 0,
"amount_due": 12990,
"amount_due_now": 12990,
"amount_paid": 0,
"amount_remaining": 12990,
"amount_subtotal": 12990,
"amount_tax": 0,
"amount_total": 12990,
"attempt_count": 0,
"billing_reason": "manual",
"collection_method": "send_invoice",
"created_at": "2026-05-19T18:00:00Z",
"currency": "brl",
"customer": "cus_9KaTnfYPTCwvFLAd",
"customer_billing_address": null,
"customer_billing_name": null,
"customer_document": null,
"customer_document_type": null,
"customer_email": null,
"customer_name": null,
"default_payment_method": null,
"description": "Mensalidade de junho",
"due_date": "2026-06-10T12:00:00Z",
"ending_balance": 0,
"finalized_at": null,
"hosted_invoice_url": null,
"interest": {
"percent_per_month": 1
},
"interest_amount": null,
"invoice_pdf_url": null,
"late_fee": {
"type": "percentage",
"value": 2
},
"late_fee_amount": null,
"latest_charge": null,
"line_items": [
{
"id": "ili_GyVv5CghtCEFZTQj",
"object": "invoice_line_item",
"amount_discount": 0,
"amount_subtotal": 12990,
"amount_tax": 0,
"amount_total": 12990,
"currency": "brl",
"description": "Mensalidade de junho",
"discountable": true,
"metadata": {},
"period_end": null,
"period_start": null,
"position": 0,
"price": null,
"price_data": {
"currency": "brl",
"unit_amount": 12990
},
"product": null,
"proration": false,
"proration_details": {},
"quantity": 1,
"recurring_interval": null,
"recurring_interval_count": null,
"subscription_item": null,
"unit_amount": 12990
}
],
"livemode": true,
"marked_uncollectible_at": null,
"metadata": {},
"next_payment_attempt": null,
"number": null,
"paid_at": null,
"paid_out_of_band": false,
"payment_intent": null,
"payment_method_types": [
"pix",
"boleto",
"credit_card"
],
"payment_settings": {
"payment_method_options": null
},
"starting_balance": 0,
"statement_descriptor": "MENSALIDADE",
"status": "draft",
"subscription": null,
"surcharge_amount": 0,
"updated_at": "2026-05-19T18:00:00Z",
"voided_at": null
}

