Faturas
Pagar uma fatura
Paga uma invoice.
curl -X POST "https://api.chargefy.io/v1/invoices/inv_2Th8gTm8USwKEyzo/pay" \
-H "Authorization: Bearer {{API_KEY}}"
{
"id": "inv_2Th8gTm8USwKEyzo",
"object": "invoice",
"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_ukMjNUqTsF6VSsch",
"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": "nome@email.com",
"customer_name": "Cliente Exemplo",
"default_payment_method": "pm_1eSxHPuxYX4TEPEF",
"description": "Ajuste mensal",
"due_date": "2026-05-19T12:00:00Z",
"ending_balance": 0,
"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_2Th8gTm8USwKEyzo.pdf",
"late_fee": {
"type": "fixed",
"value": 200
},
"late_fee_amount": null,
"latest_charge": null,
"line_items": [
{
"id": "ili_jQEZ9UNmQwSwQ7gs",
"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,
"payment_intent": "pi_XJqChDK8b8WLTpZL",
"payment_method_types": [
"credit_card"
],
"starting_balance": 0,
"statement_descriptor": "AJUSTE MENSAL",
"status": "open",
"subscription": "sub_htW6bkMnkPKd3cD6",
"updated_at": "2026-05-19T18:00:05Z",
"voided_at": null
}
Cria uma tentativa de pagamento para uma invoice
open vinculada a uma
subscription. A resposta retorna a invoice completa já apontando para o
payment_intent criado. O resultado final da cobrança chega pelos eventos
payment.intent.* e invoice.*.
Use este endpoint para cobrança server-to-server de invoices de assinatura.
Para uma invoice avulsa, compartilhe hosted_invoice_url; a página hospedada
cria a tentativa de pagamento a partir do método escolhido pelo cliente.
string
required
ID da invoice (
inv_*).string
Payment method salvo (
pm_*) para esta tentativa. Quando omitido, a Chargefy
resolve o método na ordem: default_payment_method da invoice,
default_payment_method da subscription, e default_payment_method do
customer.Quando uma tentativa desta invoice já levou uma recusa definitiva — um motivo
marcado como “não repita com o mesmo cartão” no catálogo de
recusas — recobrar com o mesmo
cartão é recusado com
402, devolvendo o code da recusa original
(card_declined quando a tentativa bloqueante não registrou um código).
Envie outro payment_method ou cadastre um novo método para o customer; com
um cartão diferente a tentativa segue normalmente.curl -X POST "https://api.chargefy.io/v1/invoices/inv_2Th8gTm8USwKEyzo/pay" \
-H "Authorization: Bearer {{API_KEY}}"
{
"id": "inv_2Th8gTm8USwKEyzo",
"object": "invoice",
"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_ukMjNUqTsF6VSsch",
"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": "nome@email.com",
"customer_name": "Cliente Exemplo",
"default_payment_method": "pm_1eSxHPuxYX4TEPEF",
"description": "Ajuste mensal",
"due_date": "2026-05-19T12:00:00Z",
"ending_balance": 0,
"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_2Th8gTm8USwKEyzo.pdf",
"late_fee": {
"type": "fixed",
"value": 200
},
"late_fee_amount": null,
"latest_charge": null,
"line_items": [
{
"id": "ili_jQEZ9UNmQwSwQ7gs",
"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,
"payment_intent": "pi_XJqChDK8b8WLTpZL",
"payment_method_types": [
"credit_card"
],
"starting_balance": 0,
"statement_descriptor": "AJUSTE MENSAL",
"status": "open",
"subscription": "sub_htW6bkMnkPKd3cD6",
"updated_at": "2026-05-19T18:00:05Z",
"voided_at": null
}
{
"error": {
"code": "invalid_request",
"message": "Only invoices linked to a subscription can be charged through this endpoint; use hosted_invoice_url for standalone invoices",
"type": "invalid_request_error"
}
}
{
"error": {
"code": "resource_state_conflict",
"message": "Invoice can only be paid while open",
"type": "invalid_request_error"
}
}
{
"error": {
"code": "transaction_not_permitted",
"message": "The last attempt on this payment method was permanently declined (transaction_not_permitted) and must not be retried with the same card. Use a different payment method.",
"param": "payment_method",
"type": "card_error"
}
}
⌘I
curl -X POST "https://api.chargefy.io/v1/invoices/inv_2Th8gTm8USwKEyzo/pay" \
-H "Authorization: Bearer {{API_KEY}}"
{
"id": "inv_2Th8gTm8USwKEyzo",
"object": "invoice",
"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_ukMjNUqTsF6VSsch",
"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": "nome@email.com",
"customer_name": "Cliente Exemplo",
"default_payment_method": "pm_1eSxHPuxYX4TEPEF",
"description": "Ajuste mensal",
"due_date": "2026-05-19T12:00:00Z",
"ending_balance": 0,
"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_2Th8gTm8USwKEyzo.pdf",
"late_fee": {
"type": "fixed",
"value": 200
},
"late_fee_amount": null,
"latest_charge": null,
"line_items": [
{
"id": "ili_jQEZ9UNmQwSwQ7gs",
"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,
"payment_intent": "pi_XJqChDK8b8WLTpZL",
"payment_method_types": [
"credit_card"
],
"starting_balance": 0,
"statement_descriptor": "AJUSTE MENSAL",
"status": "open",
"subscription": "sub_htW6bkMnkPKd3cD6",
"updated_at": "2026-05-19T18:00:05Z",
"voided_at": null
}

