Faturas
Cancelar uma fatura
Cancela uma invoice que ainda não foi paga.
curl -X POST "https://api.chargefy.io/v1/invoices/inv_YKLo3CwvvU8yTZfu/void" \
-H "Authorization: Bearer {{API_KEY}}"
{
"id": "inv_YKLo3CwvvU8yTZfu",
"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": 1,
"billing_reason": "manual",
"collection_method": "charge_automatically",
"created_at": "2026-05-19T18:00:00Z",
"currency": "brl",
"customer": "cus_Ek7KhuLZRVAFTomR",
"customer_billing_address": {
"city": "São Paulo",
"country": "BR",
"line1": "Av. Paulista, 1000",
"line2": "Conjunto 101",
"postal_code": "01310-100",
"state": "SP"
},
"customer_billing_name": "Cliente Exemplo",
"customer_document": "12345678901",
"customer_document_type": "cpf",
"customer_email": "[email protected]",
"customer_name": "Cliente Exemplo",
"default_payment_method": "pm_3ck2HC5HcbB9NQNH",
"description": "Ajuste mensal",
"due_date": "2026-05-19T12:00:00Z",
"ending_balance": 0,
"finalized_at": "2026-05-19T18:00:00Z",
"hosted_invoice_url": "https://billing.chargefy.io/invoice/ilink_8Pz6wKf3tVn2Qa9LmXr4Bc7D",
"interest": {
"percent_per_month": 1
},
"interest_amount": null,
"invoice_pdf_url": "https://billing.chargefy.io/invoice/inv_YKLo3CwvvU8yTZfu.pdf",
"late_fee": {
"type": "fixed",
"value": 200
},
"late_fee_amount": null,
"latest_charge": null,
"line_items": [
{
"id": "ili_CUCbS578X1xNQuuU",
"object": "invoice_line_item",
"amount_discount": 0,
"amount_subtotal": 12990,
"amount_tax": 0,
"amount_total": 12990,
"currency": "brl",
"description": "Ajuste mensal",
"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": "K7M2-0001",
"paid_at": null,
"paid_out_of_band": false,
"payment_intent": "pi_c7RfV2pXk9QbT4Ln",
"payment_method_types": [
"credit_card"
],
"payment_settings": {
"payment_method_options": null
},
"starting_balance": 0,
"statement_descriptor": "AJUSTE MENSAL",
"status": "void",
"subscription": "sub_d5qgmQKpt63LzZRi",
"surcharge_amount": 0,
"updated_at": "2026-05-19T18:05:00Z",
"voided_at": "2026-05-19T18:05:00Z"
}
{
"error": {
"code": "resource_state_conflict",
"message": "Invoice payment is in progress. Wait for the payment result before voiding the invoice.",
"type": "invalid_request_error"
}
}
Marca uma invoice
open como void. Invoices pagas não podem ser canceladas
por este endpoint; use o fluxo apropriado da cobrança quando precisar devolver
um pagamento já capturado.
A anulação é definitiva. Enquanto um pagamento estiver em processamento ou
aguardando confirmação, o endpoint retorna 409 com
code: resource_state_conflict e preserva a fatura e o pagamento. Aguarde o
resultado antes de tentar novamente. Se o cartão já foi aprovado, use o fluxo
de estorno da cobrança.
Pix ou boletos já emitidos podem ter sua fatura anulada, desde que não exista
outra tentativa em processamento ou um recebimento já confirmado.
Quando uma invoice é cancelada, uma URL ativa em hosted_invoice_url continua
apontando para a página da invoice, mas ela fica apenas para visualização e não
aceita pagamento.
curl -X POST "https://api.chargefy.io/v1/invoices/inv_YKLo3CwvvU8yTZfu/void" \
-H "Authorization: Bearer {{API_KEY}}"
{
"id": "inv_YKLo3CwvvU8yTZfu",
"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": 1,
"billing_reason": "manual",
"collection_method": "charge_automatically",
"created_at": "2026-05-19T18:00:00Z",
"currency": "brl",
"customer": "cus_Ek7KhuLZRVAFTomR",
"customer_billing_address": {
"city": "São Paulo",
"country": "BR",
"line1": "Av. Paulista, 1000",
"line2": "Conjunto 101",
"postal_code": "01310-100",
"state": "SP"
},
"customer_billing_name": "Cliente Exemplo",
"customer_document": "12345678901",
"customer_document_type": "cpf",
"customer_email": "[email protected]",
"customer_name": "Cliente Exemplo",
"default_payment_method": "pm_3ck2HC5HcbB9NQNH",
"description": "Ajuste mensal",
"due_date": "2026-05-19T12:00:00Z",
"ending_balance": 0,
"finalized_at": "2026-05-19T18:00:00Z",
"hosted_invoice_url": "https://billing.chargefy.io/invoice/ilink_8Pz6wKf3tVn2Qa9LmXr4Bc7D",
"interest": {
"percent_per_month": 1
},
"interest_amount": null,
"invoice_pdf_url": "https://billing.chargefy.io/invoice/inv_YKLo3CwvvU8yTZfu.pdf",
"late_fee": {
"type": "fixed",
"value": 200
},
"late_fee_amount": null,
"latest_charge": null,
"line_items": [
{
"id": "ili_CUCbS578X1xNQuuU",
"object": "invoice_line_item",
"amount_discount": 0,
"amount_subtotal": 12990,
"amount_tax": 0,
"amount_total": 12990,
"currency": "brl",
"description": "Ajuste mensal",
"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": "K7M2-0001",
"paid_at": null,
"paid_out_of_band": false,
"payment_intent": "pi_c7RfV2pXk9QbT4Ln",
"payment_method_types": [
"credit_card"
],
"payment_settings": {
"payment_method_options": null
},
"starting_balance": 0,
"statement_descriptor": "AJUSTE MENSAL",
"status": "void",
"subscription": "sub_d5qgmQKpt63LzZRi",
"surcharge_amount": 0,
"updated_at": "2026-05-19T18:05:00Z",
"voided_at": "2026-05-19T18:05:00Z"
}
{
"error": {
"code": "resource_state_conflict",
"message": "Invoice payment is in progress. Wait for the payment result before voiding the invoice.",
"type": "invalid_request_error"
}
}
Boletos pendentes
Anular a fatura também pede o cancelamento de todos os seus boletos pendentes. A confirmação do banco é assíncrona. Um recebimento posterior é registrado, sem reabrir a fatura nem reativar a assinatura: o valor fica com a organização, que decide se o devolve ao comprador. Por exemplo, um boleto de R$ 360,41 pago dois dias depois da anulação deixa o Payment Intentsucceeded, gera payment.intent.succeeded e charge.succeeded e entra no saldo da organização, e a fatura continua void, sem invoice.paid.⌘I
curl -X POST "https://api.chargefy.io/v1/invoices/inv_YKLo3CwvvU8yTZfu/void" \
-H "Authorization: Bearer {{API_KEY}}"
{
"id": "inv_YKLo3CwvvU8yTZfu",
"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": 1,
"billing_reason": "manual",
"collection_method": "charge_automatically",
"created_at": "2026-05-19T18:00:00Z",
"currency": "brl",
"customer": "cus_Ek7KhuLZRVAFTomR",
"customer_billing_address": {
"city": "São Paulo",
"country": "BR",
"line1": "Av. Paulista, 1000",
"line2": "Conjunto 101",
"postal_code": "01310-100",
"state": "SP"
},
"customer_billing_name": "Cliente Exemplo",
"customer_document": "12345678901",
"customer_document_type": "cpf",
"customer_email": "[email protected]",
"customer_name": "Cliente Exemplo",
"default_payment_method": "pm_3ck2HC5HcbB9NQNH",
"description": "Ajuste mensal",
"due_date": "2026-05-19T12:00:00Z",
"ending_balance": 0,
"finalized_at": "2026-05-19T18:00:00Z",
"hosted_invoice_url": "https://billing.chargefy.io/invoice/ilink_8Pz6wKf3tVn2Qa9LmXr4Bc7D",
"interest": {
"percent_per_month": 1
},
"interest_amount": null,
"invoice_pdf_url": "https://billing.chargefy.io/invoice/inv_YKLo3CwvvU8yTZfu.pdf",
"late_fee": {
"type": "fixed",
"value": 200
},
"late_fee_amount": null,
"latest_charge": null,
"line_items": [
{
"id": "ili_CUCbS578X1xNQuuU",
"object": "invoice_line_item",
"amount_discount": 0,
"amount_subtotal": 12990,
"amount_tax": 0,
"amount_total": 12990,
"currency": "brl",
"description": "Ajuste mensal",
"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": "K7M2-0001",
"paid_at": null,
"paid_out_of_band": false,
"payment_intent": "pi_c7RfV2pXk9QbT4Ln",
"payment_method_types": [
"credit_card"
],
"payment_settings": {
"payment_method_options": null
},
"starting_balance": 0,
"statement_descriptor": "AJUSTE MENSAL",
"status": "void",
"subscription": "sub_d5qgmQKpt63LzZRi",
"surcharge_amount": 0,
"updated_at": "2026-05-19T18:05:00Z",
"voided_at": "2026-05-19T18:05:00Z"
}
{
"error": {
"code": "resource_state_conflict",
"message": "Invoice payment is in progress. Wait for the payment result before voiding the invoice.",
"type": "invalid_request_error"
}
}

