> ## Documentation Index
> Fetch the complete documentation index at: https://docs.4seletpay.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Eventos de Fatura

> Payloads dos eventos relacionados a faturas de assinatura — criação e falha de cobrança.

## invoice.created

Disparado quando uma nova fatura de assinatura é gerada. Ocorre automaticamente a cada ciclo da assinatura.

```json Payload theme={null}
{
  "type": "invoice.created",
  "id": "hook_f6a1b2c3d4e5",
  "webhook_version": "v1",
  "data": {
    "code": "ord_invoice123",
    "status": "Pending",
    "value": 99.90,
    "payment_type": "CreditCard",
    "subscription_code": "sub_abc123xyz",
    "due_date": "2026-06-01T00:00:00.000000Z",
    "created_at": "2026-05-27T00:00:00.000000Z"
  }
}
```

| Campo               | Tipo    | Descrição                                |
| ------------------- | ------- | ---------------------------------------- |
| `code`              | string  | Código único do pedido desta fatura      |
| `status`            | string  | Status inicial (`Pending` ou `Approved`) |
| `value`             | decimal | Valor da fatura em reais                 |
| `payment_type`      | string  | Método de pagamento da assinatura        |
| `subscription_code` | string  | Código da assinatura relacionada         |
| `due_date`          | string  | Data de vencimento da fatura (ISO 8601)  |
| `created_at`        | string  | Data de geração da fatura (ISO 8601)     |

***

## invoice.failed

Disparado quando a tentativa de cobrança de uma fatura de assinatura falha — normalmente por recusa do cartão ou saldo insuficiente.

```json Payload theme={null}
{
  "type": "invoice.failed",
  "id": "hook_a1b2c3d4e5f6",
  "webhook_version": "v1",
  "data": {
    "code": "ord_invoice456",
    "status": "Failed",
    "value": 99.90,
    "payment_type": "CreditCard",
    "subscription_code": "sub_abc123xyz",
    "failure_reason": "card_declined",
    "failed_at": "2026-05-27T10:00:00.000000Z"
  }
}
```

| Campo               | Tipo    | Descrição                              |
| ------------------- | ------- | -------------------------------------- |
| `code`              | string  | Código único do pedido desta fatura    |
| `status`            | string  | Sempre `Failed`                        |
| `value`             | decimal | Valor da fatura em reais               |
| `payment_type`      | string  | Método de pagamento da assinatura      |
| `subscription_code` | string  | Código da assinatura relacionada       |
| `failure_reason`    | string  | Motivo da falha retornado pelo gateway |
| `failed_at`         | string  | Data/hora da falha (ISO 8601)          |

<Warning>
  Após uma falha de fatura, a assinatura pode entrar no status `RecurringOverdue`. Use o endpoint [Quitar fatura em atraso](/pages/faturas/pay-overdue) para permitir que o cliente regularize manualmente.
</Warning>
