> For the complete documentation index, see [llms.txt](https://hubla.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hubla.gitbook.io/docs/webhooks/eventos/fatura.md).

# Fatura

## Eventos

* [Fatura criada](#fatura-criada)
* [Status da fatura atualizada](#status-da-fatura-atualizada)
* [Pagamento da fatura realizado](#pagamento-da-fatura-realizado)
* [Pagamento da fatura falhou](#pagamento-da-fatura-falhou)
* [Fatura expirada](#fatura-expirada)
* [Fatura reembolsada](#fatura-reembolsada)

{% hint style="info" %}
Os exemplos de payload desta página estão no **modo de compatibilidade**. Se a sua regra usa a **integração recomendada**, o bloco `products` tem outro formato e uma venda com order bump gera um único aviso em vez de vários.
{% endhint %}

{% hint style="info" %}
Os exemplos desta página são de **vendas nacionais**, em que cobrança e liquidação acontecem na mesma moeda. Numa venda internacional os valores de `receivers[]` saem em outra moeda e a fatura ganha dois campos a mais — veja [Vendas internacionais](#vendas-internacionais).
{% endhint %}

{% content-ref url="/pages/oezJ7rnSnaeRGWamZg75" %}
[Como enviar seus dados](/docs/webhooks/como-enviar-seus-dados.md)
{% endcontent-ref %}

***

### Fatura criada

**O que é** — Uma nova fatura foi gerada e já está disponível para pagamento (aguardando pagamento).

**Quando dispara** — Quando a fatura entra em aberto (`status: "unpaid"`) pela primeira vez. Acompanha `invoice.status_updated`.

**Por que utilizar** — Registrar o pedido no seu sistema antes do pagamento; disparar lembrete de pagamento (pix/boleto); reservar vaga/estoque; iniciar uma régua de "aguardando pagamento".

**Como utilizar** — Leia `event.invoice.paymentMethod` (`pix`, `bank_slip` ou `credit_card`), `event.invoice.amount.totalCents` e `event.invoice.dueDate` para montar a cobrança. Deduplicar por `x-hubla-idempotency`.

{% hint style="warning" %}
Como este evento acompanha `invoice.status_updated`, trate apenas um dos dois como "criação" para não duplicar pedidos.
{% endhint %}

#### Campos-chave

| Campo                             | Descrição                                                       |
| --------------------------------- | --------------------------------------------------------------- |
| `event.invoice.status`            | `unpaid` — fatura aguardando pagamento.                         |
| `event.invoice.paymentMethod`     | Método escolhido: `pix`, `bank_slip` (boleto) ou `credit_card`. |
| `event.invoice.amount.totalCents` | Valor total em centavos.                                        |
| `event.invoice.dueDate`           | Vencimento do pagamento.                                        |
| `event.invoice.subscriptionId`    | Assinatura associada.                                           |

{% tabs %}
{% tab title="Payload" %}

```json
{
  "type": "invoice.created",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [
      {
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Integrações com Webhook 2.0",
        "offers": [
          {
            "id": "inAVzweR0QYw5y03K5mq",
            "name": "Principal",
            "cohorts": [
              {
                "id": "3a96c85e-cf82-4236-b242-7431f405c521"
              }
            ]
          }
        ]
      }
    ],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "orderId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "parentInvoiceId": null,
      "childInvoiceIds": [],
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "installments": 12,
      "paymentMethod": "credit_card",
      "currency": "BRL",
      "type": "sell",
      "status": "unpaid",
      "statusAt": [
        {
          "when": "2024-03-28T20:35:22.671Z",
          "status": "unpaid"
        }
      ],
      "coupon": {
        "code": "VIP50OFF"
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "paymentSession": {
        "ip": "220.172.165.140",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
        "url": "https://pay.hub.la/inAVzweR0QYw5y03K5mq",
        "cookies": {
          "fbp": "fb.1.1711654522671.1234567890",
          "fbclid": "IwAR3xK9mP2qL8nR5vT7wY1zA4bC6dE8fG0hI2jK4lM6nO8pQ",
          "gclid": "Cj0KCQjw1a6CBhCXARIsAGP1kWg9xY2vN5mP6qR8sT0uV2wX4yZ6aB8cD0eF",
          "hbId": "hb_7f3a9c2e1b4d8e6a",
          "gbraid": "0AAAAACabcdef1234567890ghijklmnop",
          "ttclid": "E.C.P.1234567890abcdef1234567890abcdef",
          "ttp": "01HN8K2M3P4Q5R6S7T8U9V0W1X"
        },
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        },
        "params": {
          "SCK": "ze"
        }
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      },
      "smartInstallment": {
        "cycleId": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
        "cycleType": "direct",
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-28T20:35:22.671Z",
      "version": 1
    },
    "subscriptions": [
      {
        "id": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
        "type": "recurring",
        "billingCycleMonths": 1,
        "quantity": 1
      }
    ],
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}
{% endtabs %}

***

### Status da fatura atualizada

Evento "guarda-chuva": notifica **qualquer** mudança de status da fatura. É o único que cobre transições sem evento dedicado (ex.: `disputed`, `chargeback`).

**Quando dispara** — Em toda transição de status: `unpaid`, `paid`, `overdue`, `refunded`, `disputed`, `chargeback`, `canceled`. Acompanha o evento específico da transição, quando existe (ex.: pagar dispara este evento **e** `invoice.payment_succeeded`).

**Por que utilizar** — Quando você quer uma **única fonte** para todas as mudanças de status; para capturar estados sem evento dedicado (`disputed`, `chargeback`); ou para espelhar uma máquina de estados da fatura.

**Como utilizar** — Leia `event.invoice.status` (estado atual) e `event.invoice.statusAt[]` (histórico com timestamps). Se você já assina os eventos específicos (`invoice.payment_succeeded`, `invoice.refunded`, etc.), evite processar a mesma transição duas vezes — escolha uma trilha.

{% hint style="info" %}
Os exemplos abaixo cobrem cada status possível. Todos compartilham a mesma estrutura de `event` — variam apenas em `status`, `statusAt`, `paymentMethod`, `version` e `modifiedAt`.
{% endhint %}

#### Campos-chave

| Campo                             | Descrição                                                                                                |
| --------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `event.invoice.status`            | Estado atual da fatura: `unpaid`, `paid`, `overdue`, `refunded`, `disputed`, `chargeback` ou `canceled`. |
| `event.invoice.statusAt`          | Histórico de transições (`when` + `status`).                                                             |
| `event.invoice.paymentMethod`     | Método de pagamento: `pix`, `bank_slip` (boleto) ou `credit_card`.                                       |
| `event.invoice.amount.totalCents` | Valor total em centavos.                                                                                 |
| `event.subscriptions`             | Assinaturas associadas à fatura.                                                                         |

{% tabs %}
{% tab title="Em Aberto" %}

```json
{
  "type": "invoice.status_updated",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [
      {
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Integrações com Webhook 2.0",
        "offers": [
          {
            "id": "inAVzweR0QYw5y03K5mq",
            "name": "Principal",
            "cohorts": [
              {
                "id": "3a96c85e-cf82-4236-b242-7431f405c521"
              }
            ]
          }
        ]
      }
    ],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "orderId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "parentInvoiceId": null,
      "childInvoiceIds": [],
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "installments": 12,
      "paymentMethod": "credit_card",
      "currency": "BRL",
      "type": "sell",
      "status": "unpaid",
      "statusAt": [
        {
          "when": "2024-03-28T20:35:22.671Z",
          "status": "unpaid"
        }
      ],
      "coupon": {
        "code": "VIP50OFF"
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "paymentSession": {
        "ip": "220.172.165.140",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
        "url": "https://pay.hub.la/inAVzweR0QYw5y03K5mq",
        "cookies": {
          "fbp": "fb.1.1711654522671.1234567890",
          "fbclid": "IwAR3xK9mP2qL8nR5vT7wY1zA4bC6dE8fG0hI2jK4lM6nO8pQ",
          "gclid": "Cj0KCQjw1a6CBhCXARIsAGP1kWg9xY2vN5mP6qR8sT0uV2wX4yZ6aB8cD0eF",
          "hbId": "hb_7f3a9c2e1b4d8e6a",
          "gbraid": "0AAAAACabcdef1234567890ghijklmnop",
          "ttclid": "E.C.P.1234567890abcdef1234567890abcdef",
          "ttp": "01HN8K2M3P4Q5R6S7T8U9V0W1X"
        },
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        },
        "params": {
          "SCK": "ze"
        }
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      },
      "smartInstallment": {
        "cycleId": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
        "cycleType": "direct",
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-28T20:35:22.671Z",
      "version": 8
    },
    "subscriptions": [
      {
        "id": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
        "type": "recurring",
        "billingCycleMonths": 1,
        "quantity": 1
      }
    ],
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}

{% tab title="Vencido" %}

```json
{
  "type": "invoice.status_updated",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [
      {
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Integrações com Webhook 2.0",
        "offers": [
          {
            "id": "inAVzweR0QYw5y03K5mq",
            "name": "Principal",
            "cohorts": [
              {
                "id": "3a96c85e-cf82-4236-b242-7431f405c521"
              }
            ]
          }
        ]
      }
    ],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "orderId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "parentInvoiceId": null,
      "childInvoiceIds": [],
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "installments": 1,
      "paymentMethod": "pix",
      "currency": "BRL",
      "type": "sell",
      "status": "overdue",
      "statusAt": [
        {
          "when": "2024-03-28T20:35:22.671Z",
          "status": "unpaid"
        },
        {
          "when": "2024-03-29T20:35:33.512Z",
          "status": "overdue"
        }
      ],
      "coupon": {
        "code": "VIP50OFF"
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "paymentSession": {
        "ip": "220.172.165.140",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
        "url": "https://pay.hub.la/inAVzweR0QYw5y03K5mq",
        "cookies": {
          "fbp": "fb.1.1711654522671.1234567890",
          "fbclid": "IwAR3xK9mP2qL8nR5vT7wY1zA4bC6dE8fG0hI2jK4lM6nO8pQ",
          "gclid": "Cj0KCQjw1a6CBhCXARIsAGP1kWg9xY2vN5mP6qR8sT0uV2wX4yZ6aB8cD0eF",
          "hbId": "hb_7f3a9c2e1b4d8e6a",
          "gbraid": "0AAAAACabcdef1234567890ghijklmnop",
          "ttclid": "E.C.P.1234567890abcdef1234567890abcdef",
          "ttp": "01HN8K2M3P4Q5R6S7T8U9V0W1X"
        },
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        },
        "params": {
          "SCK": "ze"
        }
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      },
      "smartInstallment": {
        "cycleId": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
        "cycleType": "direct",
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-29T20:35:33.512Z",
      "version": 6
    },
    "subscriptions": [
      {
        "id": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
        "type": "recurring",
        "billingCycleMonths": 1,
        "quantity": 1
      }
    ],
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}

{% tab title="Pago" %}

```json
{
  "type": "invoice.status_updated",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [
      {
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Integrações com Webhook 2.0",
        "offers": [
          {
            "id": "inAVzweR0QYw5y03K5mq",
            "name": "Principal",
            "cohorts": [
              {
                "id": "3a96c85e-cf82-4236-b242-7431f405c521"
              }
            ]
          }
        ]
      }
    ],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "orderId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "parentInvoiceId": null,
      "childInvoiceIds": [],
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "installments": 12,
      "paymentMethod": "credit_card",
      "currency": "BRL",
      "type": "sell",
      "status": "paid",
      "statusAt": [
        {
          "when": "2024-03-28T20:35:22.671Z",
          "status": "unpaid"
        },
        {
          "when": "2024-03-28T20:35:33.512Z",
          "status": "paid"
        }
      ],
      "coupon": {
        "code": "VIP50OFF"
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "paymentSession": {
        "ip": "220.172.165.140",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
        "url": "https://pay.hub.la/inAVzweR0QYw5y03K5mq",
        "cookies": {
          "fbp": "fb.1.1711654522671.1234567890",
          "fbclid": "IwAR3xK9mP2qL8nR5vT7wY1zA4bC6dE8fG0hI2jK4lM6nO8pQ",
          "gclid": "Cj0KCQjw1a6CBhCXARIsAGP1kWg9xY2vN5mP6qR8sT0uV2wX4yZ6aB8cD0eF",
          "hbId": "hb_7f3a9c2e1b4d8e6a",
          "gbraid": "0AAAAACabcdef1234567890ghijklmnop",
          "ttclid": "E.C.P.1234567890abcdef1234567890abcdef",
          "ttp": "01HN8K2M3P4Q5R6S7T8U9V0W1X"
        },
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        },
        "params": {
          "SCK": "ze"
        }
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      },
      "smartInstallment": {
        "cycleId": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
        "cycleType": "direct",
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-28T20:35:33.512Z",
      "version": 8
    },
    "subscriptions": [
      {
        "id": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
        "type": "recurring",
        "billingCycleMonths": 1,
        "quantity": 1
      }
    ],
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}

{% tab title="Reembolsada" %}

```json
{
  "type": "invoice.status_updated",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [
      {
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Integrações com Webhook 2.0",
        "offers": [
          {
            "id": "inAVzweR0QYw5y03K5mq",
            "name": "Principal",
            "cohorts": [
              {
                "id": "3a96c85e-cf82-4236-b242-7431f405c521"
              }
            ]
          }
        ]
      }
    ],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "orderId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "parentInvoiceId": null,
      "childInvoiceIds": [],
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "installments": 12,
      "paymentMethod": "credit_card",
      "currency": "BRL",
      "type": "sell",
      "status": "refunded",
      "statusAt": [
        {
          "when": "2024-03-28T20:35:22.671Z",
          "status": "unpaid"
        },
        {
          "when": "2024-03-28T20:35:33.512Z",
          "status": "paid"
        },
        {
          "when": "2024-03-28T21:47:53.177Z",
          "status": "refunded"
        }
      ],
      "coupon": {
        "code": "VIP50OFF"
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "paymentSession": {
        "ip": "220.172.165.140",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
        "url": "https://pay.hub.la/inAVzweR0QYw5y03K5mq",
        "cookies": {
          "fbp": "fb.1.1711654522671.1234567890",
          "fbclid": "IwAR3xK9mP2qL8nR5vT7wY1zA4bC6dE8fG0hI2jK4lM6nO8pQ",
          "gclid": "Cj0KCQjw1a6CBhCXARIsAGP1kWg9xY2vN5mP6qR8sT0uV2wX4yZ6aB8cD0eF",
          "hbId": "hb_7f3a9c2e1b4d8e6a",
          "gbraid": "0AAAAACabcdef1234567890ghijklmnop",
          "ttclid": "E.C.P.1234567890abcdef1234567890abcdef",
          "ttp": "01HN8K2M3P4Q5R6S7T8U9V0W1X"
        },
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        },
        "params": {
          "SCK": "ze"
        }
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      },
      "smartInstallment": {
        "cycleId": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
        "cycleType": "direct",
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-28T21:47:53.177Z",
      "version": 9
    },
    "subscriptions": [
      {
        "id": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
        "type": "recurring",
        "billingCycleMonths": 1,
        "quantity": 1
      }
    ],
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}

{% tab title="Em Disputa" %}

```json
{
  "type": "invoice.status_updated",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [
      {
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Integrações com Webhook 2.0",
        "offers": [
          {
            "id": "inAVzweR0QYw5y03K5mq",
            "name": "Principal",
            "cohorts": [
              {
                "id": "3a96c85e-cf82-4236-b242-7431f405c521"
              }
            ]
          }
        ]
      }
    ],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "orderId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "parentInvoiceId": null,
      "childInvoiceIds": [],
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "installments": 12,
      "paymentMethod": "credit_card",
      "currency": "BRL",
      "type": "sell",
      "status": "disputed",
      "statusAt": [
        {
          "when": "2024-03-28T20:35:22.671Z",
          "status": "unpaid"
        },
        {
          "when": "2024-03-28T20:35:33.512Z",
          "status": "paid"
        },
        {
          "when": "2024-03-28T21:04:34.720Z",
          "status": "disputed"
        }
      ],
      "coupon": {
        "code": "VIP50OFF"
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "paymentSession": {
        "ip": "220.172.165.140",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
        "url": "https://pay.hub.la/inAVzweR0QYw5y03K5mq",
        "cookies": {
          "fbp": "fb.1.1711654522671.1234567890",
          "fbclid": "IwAR3xK9mP2qL8nR5vT7wY1zA4bC6dE8fG0hI2jK4lM6nO8pQ",
          "gclid": "Cj0KCQjw1a6CBhCXARIsAGP1kWg9xY2vN5mP6qR8sT0uV2wX4yZ6aB8cD0eF",
          "hbId": "hb_7f3a9c2e1b4d8e6a",
          "gbraid": "0AAAAACabcdef1234567890ghijklmnop",
          "ttclid": "E.C.P.1234567890abcdef1234567890abcdef",
          "ttp": "01HN8K2M3P4Q5R6S7T8U9V0W1X"
        },
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        },
        "params": {
          "SCK": "ze"
        }
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      },
      "smartInstallment": {
        "cycleId": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
        "cycleType": "direct",
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-28T21:04:34.721Z",
      "version": 8
    },
    "subscriptions": [
      {
        "id": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
        "type": "recurring",
        "billingCycleMonths": 1,
        "quantity": 1
      }
    ],
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}

{% tab title="Chargeback" %}

```json
{
  "type": "invoice.status_updated",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [
      {
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Integrações com Webhook 2.0",
        "offers": [
          {
            "id": "inAVzweR0QYw5y03K5mq",
            "name": "Principal",
            "cohorts": [
              {
                "id": "3a96c85e-cf82-4236-b242-7431f405c521"
              }
            ]
          }
        ]
      }
    ],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "orderId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "parentInvoiceId": null,
      "childInvoiceIds": [],
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "installments": 12,
      "paymentMethod": "credit_card",
      "currency": "BRL",
      "type": "sell",
      "status": "chargeback",
      "statusAt": [
        {
          "when": "2024-03-28T20:35:22.671Z",
          "status": "unpaid"
        },
        {
          "when": "2024-03-28T20:35:33.512Z",
          "status": "paid"
        },
        {
          "when": "2024-03-28T21:04:34.720Z",
          "status": "disputed"
        },
        {
          "when": "2024-03-28T22:38:34.720Z",
          "status": "chargeback"
        }
      ],
      "coupon": {
        "code": "VIP50OFF"
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "paymentSession": {
        "ip": "220.172.165.140",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
        "url": "https://pay.hub.la/inAVzweR0QYw5y03K5mq",
        "cookies": {
          "fbp": "fb.1.1711654522671.1234567890",
          "fbclid": "IwAR3xK9mP2qL8nR5vT7wY1zA4bC6dE8fG0hI2jK4lM6nO8pQ",
          "gclid": "Cj0KCQjw1a6CBhCXARIsAGP1kWg9xY2vN5mP6qR8sT0uV2wX4yZ6aB8cD0eF",
          "hbId": "hb_7f3a9c2e1b4d8e6a",
          "gbraid": "0AAAAACabcdef1234567890ghijklmnop",
          "ttclid": "E.C.P.1234567890abcdef1234567890abcdef",
          "ttp": "01HN8K2M3P4Q5R6S7T8U9V0W1X"
        },
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        },
        "params": {
          "SCK": "ze"
        }
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      },
      "smartInstallment": {
        "cycleId": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
        "cycleType": "direct",
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-28T22:38:34.720Z",
      "version": 9
    },
    "subscriptions": [
      {
        "id": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
        "type": "recurring",
        "billingCycleMonths": 1,
        "quantity": 1
      }
    ],
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}
{% endtabs %}

***

### Pagamento da fatura realizado

**O que é** — O pagamento da fatura foi confirmado. Este é o "gatilho de compra aprovada".

**Quando dispara** — Quando a fatura passa para `status: "paid"` e o status anterior **não** era `disputed`. Acompanha o evento [`invoice.status_updated`](#status-da-fatura-atualizada).

**Por que utilizar** — Liberar acesso/entrega ao cliente; emitir nota fiscal; conciliar receita; iniciar onboarding. É o evento que a maioria das automações de "venda realizada" deve escutar.

**Como utilizar** — Valide `event.invoice.status === "paid"`. Use `event.invoice.amount.totalCents` para o valor bruto e `event.invoice.receivers[]` (`role: "seller"`, campo `totalCents`) para o líquido do vendedor.

{% hint style="warning" %}
Deduplique os eventos pelo cabeçalho `x-hubla-idempotency` (veja [boas práticas](/docs/webhooks/boas-praticas.md)) e não confunda este evento com o `invoice.status_updated` que o acompanha — ambos são enviados quando a fatura é paga.
{% endhint %}

#### Campos-chave

| Campo                             | Descrição                                                            |
| --------------------------------- | -------------------------------------------------------------------- |
| `event.invoice.status`            | `paid`.                                                              |
| `event.invoice.amount.totalCents` | Valor bruto em centavos.                                             |
| `event.invoice.receivers[]`       | Splits; `role: "seller"` traz o líquido do vendedor em `totalCents`. |
| `event.invoice.paymentMethod`     | Método usado no pagamento.                                           |
| `event.invoice.subscriptionId`    | Assinatura associada.                                                |

{% tabs %}
{% tab title="Payload" %}

```json
{
  "type": "invoice.payment_succeeded",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [{
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0",
      "offers": [{
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Principal",
        "cohorts": [{ "id": "3a96c85e-cf82-4236-b242-7431f405c521" }]
      }]
    }],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "installments": 12,
      "paymentMethod": "credit_card",
      "currency": "BRL",
      "type": "sell",
      "status": "paid",
      "statusAt": [
        {
          "status": "unpaid",
          "when": "2024-03-28T20:35:22.671Z"
        },
        {
          "status": "paid",
          "when": "2024-03-28T20:35:33.512Z"
        }
      ],
      "coupon": {
        "code": "VIP50OFF"
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "firstPaymentSession": {
        "ip": "220.172.165.140",
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        }
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      },
      "smartInstallment": {
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-28T20:35:33.518Z",
      "version": 6
    },
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}
{% endtabs %}

***

### Pagamento da fatura falhou

**O que é** — Uma tentativa de cobrança **no cartão de crédito** falhou.

**Quando dispara** — Quando a fatura vai para `status: "overdue"` **e** o `paymentMethod` é `credit_card`. Acompanha o evento [`invoice.status_updated`](#status-da-fatura-atualizada). Diferencia-se de [`invoice.expired`](#fatura-expirada), que cobre o mesmo `overdue` para pix/boleto.

**Por que utilizar** — Régua de recuperação de cartão (retry/dunning); avisar o cliente para atualizar o cartão; pausar acesso em assinaturas com pagamento em atraso.

**Como utilizar** — Cheque `event.invoice.status === "overdue"` **e** `event.invoice.paymentMethod === "credit_card"`. Para não colidir com `invoice.expired`, sempre valide o `paymentMethod`.

#### Campos-chave

| Campo                             | Descrição                                               |
| --------------------------------- | ------------------------------------------------------- |
| `event.invoice.status`            | `overdue`.                                              |
| `event.invoice.paymentMethod`     | `credit_card` (é o que distingue de `invoice.expired`). |
| `event.invoice.amount.totalCents` | Valor da cobrança que falhou.                           |
| `event.invoice.dueDate`           | Vencimento.                                             |
| `event.invoice.subscriptionId`    | Assinatura associada.                                   |

{% tabs %}
{% tab title="Payload" %}

```json
{
  "type": "invoice.payment_failed",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [{
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0",
      "offers": [{
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Principal",
        "cohorts": [{ "id": "3a96c85e-cf82-4236-b242-7431f405c521" }]
      }]
    }],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "installments": 12,
      "paymentMethod": "credit_card",
      "currency": "BRL",
      "type": "sell",
      "status": "overdue",
      "statusAt": [
        {
          "status": "unpaid",
          "when": "2024-03-28T20:35:22.671Z"
        },
        {
          "status": "overdue",
          "when": "2024-03-28T20:35:45.124Z"
        }
      ],
      "coupon": {
        "code": "VIP50OFF"
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "firstPaymentSession": {
        "ip": "220.172.165.140",
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        }
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      },
      "smartInstallment": {
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-28T20:35:22.671Z",
      "version": 8
    },
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}
{% endtabs %}

***

### Fatura expirada

**O que é** — Uma fatura não paga venceu (pix ou boleto não pagos até o vencimento).

**Quando dispara** — Quando a fatura vai para `status: "overdue"` **e** o `paymentMethod` **não** é `credit_card` (pix/boleto). Acompanha o `invoice.status_updated`. Diferencia-se do `invoice.payment_failed`, que cobre o mesmo `overdue` para cartão.

**Por que utilizar** — Encerrar pedido não pago; liberar estoque/vaga reservada; disparar régua de reengajamento para pix/boleto vencido.

**Como utilizar** — Cheque `event.invoice.status === "overdue"` **e** `event.invoice.paymentMethod` em (`pix`, `bank_slip`).

{% hint style="warning" %}
Sempre valide o `paymentMethod` para não colidir com o `invoice.payment_failed`.
{% endhint %}

**Campos-chave**

| Campo                             | Descrição                                                     |
| --------------------------------- | ------------------------------------------------------------- |
| `event.invoice.status`            | `overdue`.                                                    |
| `event.invoice.paymentMethod`     | `pix` ou `bank_slip` (distingue do `invoice.payment_failed`). |
| `event.invoice.dueDate`           | Vencimento que passou.                                        |
| `event.invoice.amount.totalCents` | Valor não pago.                                               |

{% tabs %}
{% tab title="Payload" %}

```json
{
  "type": "invoice.expired",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [{
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0",
      "offers": [{
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Principal",
        "cohorts": [{ "id": "3a96c85e-cf82-4236-b242-7431f405c521" }]
      }]
    }],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "orderId": "c1f0a5d2-9b64-4f1e-8a77-5c2f0d3b7e19",
      "parentInvoiceId": "b2a7c4e8-3d51-4c9a-9f16-8e0d5a2b6c31",
      "childInvoiceIds": [],
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "installments": 1,
      "paymentMethod": "pix",
      "currency": "BRL",
      "type": "sell",
      "status": "overdue",
      "statusAt": [
        {
          "status": "unpaid",
          "when": "2024-03-28T20:35:22.671Z"
        },
        {
          "status": "overdue",
          "when": "2024-03-29T20:35:33.512Z"
        }
      ],
      "coupon": {
        "code": "VIP50OFF"
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "paymentSession": {
        "ip": "220.172.165.140",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
        "url": "https://pay.hub.la/inAVzweR0QYw5y03K5mq?utm_source=email&src=newsletter&sck=lista-quente",
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        },
        "cookies": {
          "fbp": "fb.1.1711657200000.1234567890",
          "fbclid": "IwAR1exampleFbclid",
          "gclid": "CjwKCAjwexampleGclid",
          "hbId": "3f0c1d2e-4b5a-4789-a0b1-c2d3e4f5a6b7",
          "gbraid": "0AAAAAexampleGbraid",
          "ttclid": "E.C.P.exampleTtclid",
          "ttp": "2f1b3c4d-5e6f-4a8b-9c0d-1e2f3a4b5c6d"
        },
        "params": {
          "src": "newsletter",
          "sck": "lista-quente"
        }
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      },
      "smartInstallment": {
        "cycleId": "9c8b7a6d-5e4f-4210-9876-5a4b3c2d1e0f",
        "cycleType": "recovery",
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-29T20:35:33.512Z",
      "version": 6
    },
    "subscriptions": [{
      "id": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "type": "one_time",
      "billingCycleMonths": 1,
      "quantity": 1
    }],
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}
{% endtabs %}

***

### Fatura reembolsada

**O que é** — Uma fatura que estava paga foi reembolsada com sucesso.

**Quando dispara** — Quando a fatura passa para `status: "refunded"` (internamente `returned`). Acompanha `invoice.status_updated`.

**Por que utilizar** — Revogar acesso/entrega; estornar comissões; conciliação financeira; encerrar a assinatura associada.

**Como utilizar** — Valide `event.invoice.status === "refunded"` e use `event.invoice.statusAt[]` para confirmar o histórico `paid → refunded`. Deduplicar por `x-hubla-idempotency`.

{% hint style="warning" %}
Como este evento acompanha `invoice.status_updated`, trate apenas um dos dois como "reembolso" para não revogar acesso ou estornar comissões duas vezes.
{% endhint %}

#### Campos-chave

| Campo                             | Descrição                                |
| --------------------------------- | ---------------------------------------- |
| `event.invoice.status`            | `refunded`.                              |
| `event.invoice.statusAt`          | Histórico confirmando `paid → refunded`. |
| `event.invoice.amount.totalCents` | Valor reembolsado.                       |
| `event.invoice.subscriptionId`    | Assinatura associada.                    |

{% tabs %}
{% tab title="Payload" %}

```json
{
  "type": "invoice.refunded",
  "event": {
    "product": {
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0"
    },
    "products": [{
      "id": "inAVzweR0QYw5y03K5mq",
      "name": "Integrações com Webhook 2.0",
      "offers": [{
        "id": "inAVzweR0QYw5y03K5mq",
        "name": "Principal",
        "cohorts": [{ "id": "3a96c85e-cf82-4236-b242-7431f405c521" }]
      }]
    }],
    "invoice": {
      "id": "7614b1bb-1d1a-43ba-890c-50d74216eb56",
      "orderId": "8f1e5c9a-3b7d-42c6-9f0e-1a2b3c4d5e6f",
      "childInvoiceIds": [],
      "subscriptionId": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
      "payerId": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "payer": {
        "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
        "firstName": "John",
        "lastName": "Doe",
        "document": "12345678000190",
        "email": "johndoe.payer@example.com",
        "phone": "+5511999999999"
      },
      "sellerId": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "installments": 12,
      "paymentMethod": "credit_card",
      "currency": "BRL",
      "coupon": {
        "code": "VIP50OFF"
      },
      "type": "sell",
      "status": "refunded",
      "statusAt": [
        {
          "status": "unpaid",
          "when": "2024-03-28T20:35:22.671Z"
        },
        {
          "status": "paid",
          "when": "2024-03-28T20:35:33.512Z"
        },
        {
          "status": "refunded",
          "when": "2024-03-28T21:47:53.177Z"
        }
      ],
      "paymentSession": {
        "ip": "220.172.165.140",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
        "url": "https://pay.hub.la/inAVzweR0QYw5y03K5mq?src=newsletter&sck=lista-vip&utm_source=email",
        "utm": {
          "source": "email",
          "medium": "active-campaign",
          "campaign": "[LEAD][QUENTE][24][MAR]",
          "content": "2024032812H",
          "term": "PROMO10OFF"
        },
        "cookies": {
          "fbp": "fb.1.1711658122671.1234567890",
          "fbclid": "IwAR0abc123def456",
          "gclid": "CjwKCAjw-abc123",
          "hbId": "3639911e-cfa3-47b3-80a6-d215dba62be4",
          "gbraid": "0AAAAA-abc123",
          "ttclid": "E.C.P.abc123",
          "ttp": "2a3b4c5d-6e7f-4a8b-9c0d-1e2f3a4b5c6d"
        },
        "params": {
          "src": "newsletter",
          "sck": "lista-vip"
        }
      },
      "amount": {
        "subtotalCents": 120000,
        "discountCents": 24000,
        "prorataCents": 0,
        "installmentFeeCents": 16320,
        "totalCents": 112320
      },
      "receivers": [
        {
          "id": "platform-identity",
          "name": "Hubla Tecnologia LTDA",
          "email": "suporte@hub.la",
          "phone": "+5531999715693",
          "role": "platform",
          "paysForFees": false,
          "totalCents": 25778,
          "currency": "BRL"
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542,
          "currency": "BRL"
        }
      ],
      "saleDate": "2024-03-28T20:35:22.671Z",
      "dueDate": "2024-03-28T20:35:16.350Z",
      "createdAt": "2024-03-28T20:35:22.671Z",
      "modifiedAt": "2024-03-28T21:47:53.177Z",
      "version": 9,
      "smartInstallment": {
        "cycleId": "6f2b1c0a-9d84-4f31-8a55-2e7c1b9d0f43",
        "cycleType": "recovery",
        "sourceInvoiceId": "ID da invoice que gerou o parcelamento inteligente",
        "installment": 1,
        "installments": 12
      },
      "billingAddress": {
        "countryCode": "BR",
        "state": "São Paulo",
        "city": "São Paulo",
        "neighborhood": "Bela Vista",
        "street": "Av. Paulista",
        "complement": "MASP",
        "number": "1578",
        "postalCode": "01310-200"
      }
    },
    "subscriptions": [
      {
        "id": "d7ab5027-5bca-476c-ac29-68f1359ee6ca",
        "type": "recurring",
        "billingCycleMonths": 1,
        "quantity": 1
      }
    ],
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```

{% endtab %}
{% endtabs %}

***

## Eventos em par

Toda mudança de status dispara `invoice.status_updated` **e**, quando aplicável, um evento específico (ex.: um pagamento dispara `invoice.status_updated` + `invoice.payment_succeeded`). Se você assina os dois, **escolha uma trilha por transição** para não processar a mesma mudança duas vezes.

{% hint style="warning" %}
**Exceção:** quando uma disputa é resolvida a favor do vendedor (`disputed` → `paid`), a Hubla emite apenas `invoice.status_updated`, **sem** `invoice.payment_succeeded`. Se o seu fluxo de liberação de acesso depende só de `invoice.payment_succeeded`, esse caso não será coberto.
{% endhint %}

***

## Vendas internacionais

Numa venda internacional a cobrança acontece em uma moeda e a liquidação em outra. A moeda em que o comprador foi cobrado é a **moeda de apresentação** — é o que `invoice.currency` e `invoice.amount` sempre informaram. Já os valores repassados a cada participante do split são liquidados na **moeda de liquidação**, que pode ser diferente.

Para deixar as duas explícitas, a fatura traz três campos:

| Campo                          | Presença                  | O que informa                                                   |
| ------------------------------ | ------------------------- | --------------------------------------------------------------- |
| `invoice.receivers[].currency` | Sempre                    | A moeda em que o `totalCents` daquele receiver está denominado. |
| `invoice.amount.settlement`    | Só em venda internacional | O total na moeda de liquidação — é o valor que o split divide.  |
| `invoice.currencyConversion`   | Só em venda internacional | A taxa de conversão travada para aquela venda.                  |

**Numa venda nacional nada muda na prática.** `receivers[].currency` repete a moeda da fatura e os outros dois campos não são enviados — não houve conversão, então não devolvemos uma conversão que não aconteceu.

{% hint style="danger" %}
**A soma dos `receivers[].totalCents` fecha com a moeda de liquidação, não com `amount.totalCents`.** Numa venda internacional os dois valores estão em moedas diferentes e a conta não bate. Se a sua conciliação compara a soma do split com `amount.totalCents`, ela vai acusar divergência nessas vendas.
{% endhint %}

### Comparando as duas vendas

{% tabs %}
{% tab title="Venda nacional (BRL)" %}
Cobrança e liquidação em BRL: `receivers[].currency` acompanha `invoice.currency`, e nem `amount.settlement` nem `currencyConversion` aparecem.

```json
{
  "currency": "BRL",
  "amount": {
    "subtotalCents": 10000,
    "discountCents": 0,
    "prorataCents": 0,
    "installmentFeeCents": 0,
    "totalCents": 10000
  },
  "receivers": [
    {
      "id": "platform-identity",
      "name": "Hubla Tecnologia LTDA",
      "role": "platform",
      "paysForFees": false,
      "totalCents": 2300,
      "currency": "BRL"
    },
    {
      "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "name": "Victor Lott",
      "role": "seller",
      "paysForFees": true,
      "totalCents": 7700,
      "currency": "BRL"
    }
  ]
}
```

`2300 + 7700 = 10000` — a soma dos receivers fecha com `amount.totalCents`.
{% endtab %}

{% tab title="Venda internacional (EUR → USD)" %}
O comprador foi cobrado **100,00 EUR** e a venda liquidou **108,00 USD**, a uma taxa de `1.08`. Os valores dos receivers estão em **USD**, não em EUR.

```json
{
  "currency": "EUR",
  "amount": {
    "subtotalCents": 10000,
    "discountCents": 0,
    "prorataCents": 0,
    "installmentFeeCents": 0,
    "totalCents": 10000,
    "settlement": {
      "subtotalCents": 10000,
      "taxAmountCents": 800,
      "totalCents": 10800,
      "currency": "USD"
    }
  },
  "receivers": [
    {
      "id": "platform-identity",
      "name": "Hubla Tecnologia LTDA",
      "role": "platform",
      "paysForFees": false,
      "totalCents": 2484,
      "currency": "USD"
    },
    {
      "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
      "name": "Victor Lott",
      "role": "seller",
      "paysForFees": true,
      "totalCents": 8316,
      "currency": "USD"
    }
  ],
  "currencyConversion": {
    "presentmentCurrency": "EUR",
    "settlementCurrency": "USD",
    "rate": 1.08,
    "rateAt": "2026-08-05T12:00:00.000Z"
  }
}
```

`2484 + 8316 = 10800` — fecha com `amount.settlement.totalCents`, e **não** com `amount.totalCents`, que está em EUR. A taxa permite auditar o valor liquidado: `10000 × 1.08 = 10800`.
{% endtab %}
{% endtabs %}

### Como conciliar nos dois casos

Use `amount.settlement` quando ele estiver presente e caia para `amount` quando não estiver — assim o mesmo código atende venda nacional e internacional:

{% code title="conciliacao.js" %}

```javascript
const invoice = payload.event.invoice

const total = invoice.amount.settlement?.totalCents ?? invoice.amount.totalCents
const currency = invoice.amount.settlement?.currency ?? invoice.currency

const somaDosReceivers = invoice.receivers.reduce((soma, receiver) => soma + receiver.totalCents, 0)
// somaDosReceivers === total, sempre na moeda `currency`
```

{% endcode %}

Para saber em que moeda cada valor está, leia `receivers[].currency` — não assuma `invoice.currency`.

{% hint style="info" %}
**Nada foi removido nem renomeado.** Os três campos são aditivos: `invoice.currency` e `invoice.amount` continuam na moeda de apresentação, com o mesmo significado de antes. Trate `amount.settlement` e `currencyConversion` como opcionais.
{% endhint %}

{% hint style="warning" %}
O [ambiente de testes](/docs/webhooks/sandbox.md) simula uma **venda nacional em BRL** e, por isso, não faz preview do formato internacional: nele `receivers[].currency` vem como `BRL` e os outros dois campos não são enviados. Para ver `amount.settlement` e `currencyConversion`, use uma fatura internacional real.
{% endhint %}

Os mesmos campos aparecem nos eventos de [Solicitação de Reembolso](/docs/webhooks/eventos/solicitacao-de-reembolso.md), que carregam a fatura no mesmo formato.

***

## Migrando de outra plataforma

Se você já integra com outra plataforma, use esta tabela para encontrar o evento de fatura equivalente na Hubla. Quando não há equivalente 1:1, indicamos o mais próximo.

| Plataforma | Evento de origem                                                   | Evento de Fatura na Hubla                                                                                                |
| ---------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| Hotmart    | Compra aprovada (`PURCHASE_APPROVED`)                              | `invoice.payment_succeeded` — `invoice.type` distingue `sell`, `renewal` e `upgrade`                                     |
| Hotmart    | Compra completa (`PURCHASE_COMPLETE`)                              | Sem equivalente — a Hubla não emite evento no fim da garantia                                                            |
| Hotmart    | Aguardando pagamento / boleto impresso (`PURCHASE_BILLET_PRINTED`) | `invoice.created` — na Hubla dispara para todo método de pagamento, não só boleto                                        |
| Hotmart    | Compra expirada (`PURCHASE_EXPIRED`)                               | `invoice.expired`                                                                                                        |
| Hotmart    | Compra atrasada (`PURCHASE_DELAYED`)                               | `invoice.payment_failed` (cartão) ou `invoice.expired` (pix/boleto)                                                      |
| Hotmart    | Reembolso (`PURCHASE_REFUNDED`)                                    | `invoice.refunded` — só reembolso total; no parcial sai apenas `invoice.status_updated`, também com `status: "refunded"` |
| Hotmart    | Pedido de reembolso / disputa (`PURCHASE_PROTEST`)                 | `refund_request.created` (a solicitação); na fatura, `invoice.status_updated` com `status: "disputed"`                   |
| Hotmart    | Chargeback (`PURCHASE_CHARGEBACK`)                                 | `invoice.status_updated` com `status: "chargeback"`                                                                      |
| Hotmart    | Compra cancelada (`PURCHASE_CANCELED`)                             | `invoice.status_updated` com `status: "canceled"`                                                                        |
| Kiwify     | Boleto gerado (`billet_created`)                                   | `invoice.created`                                                                                                        |
| Kiwify     | Pix gerado (`pix_created`)                                         | `invoice.created`                                                                                                        |
| Kiwify     | Compra aprovada (`order_approved`)                                 | `invoice.payment_succeeded` com `invoice.type: "sell"`                                                                   |
| Kiwify     | Assinatura renovada (`subscription_renewed`)                       | `invoice.payment_succeeded` com `invoice.type: "renewal"`                                                                |
| Kiwify     | Assinatura atrasada (`subscription_late`)                          | `invoice.payment_failed` (cartão) ou `invoice.expired` (pix/boleto)                                                      |
| Kiwify     | Compra recusada (`order_rejected`)                                 | Sem equivalente — `invoice.payment_failed` só dispara em cobrança vencida no cartão, não em recusa no checkout           |
| Kiwify     | Reembolso (`order_refunded`)                                       | `invoice.refunded` — só reembolso total                                                                                  |
| Kiwify     | Chargeback (`chargeback`)                                          | `invoice.status_updated` com `status: "chargeback"`                                                                      |

{% hint style="warning" %}
Na Hubla, `invoice.expired` e `invoice.payment_failed` saem da **mesma** transição de status (`→ overdue`), separados apenas pelo método de pagamento. Não é possível distinguir "boleto da primeira compra venceu" de "cobrança de renovação em pix atrasou" — na Hotmart esses casos são eventos diferentes (`PURCHASE_EXPIRED` e `PURCHASE_DELAYED`).
{% endhint %}

{% hint style="info" %}
Carrinho abandonado, pedidos de reembolso e eventos de assinatura mapeiam para outros grupos (`lead.abandoned_checkout`, `refund_request.*`, `subscription.*`), documentados em suas próprias páginas: [Lead](/docs/webhooks/eventos/lead.md), [Solicitação de Reembolso](/docs/webhooks/eventos/solicitacao-de-reembolso.md) e [Assinatura](/docs/webhooks/eventos/assinatura.md). O cancelamento de assinatura (`SUBSCRIPTION_CANCELLATION` na Hotmart, `subscription_canceled` na Kiwify) também está em [Assinatura](/docs/webhooks/eventos/assinatura.md). Atenção: o evento de carrinho abandonado da Kiwify **não** envia o parâmetro `webhook_event_type` — é identificado apenas pela forma do payload.
{% endhint %}

***

## Propriedades

Os eventos de fatura seguem um padrão de payload e propriedades, sendo elas:

{% tabs %}
{% tab title="Propriedades" %}
**type** `string`

Tipo do evento de Webhook

***

**version** `string`

Versão do contrato do payload. Neste caso o valor esperado será sempre `v2.0.0`.

***

**event.product.id** `string`

Identificador único do produto

***

**event.product.name** `string`

Nome do produto no momento da compra

***

**event.payer** `object`

Representa as informações do comprador no momento da compra

***

**event.payer.id** `string`

Identificador único do comprador cadastrado na plataforma

***

**event.payer.firstName** `string`

Primeiro nome do comprador cadastrado na plataforma

***

**event.payer.lastName** `string`

Sobrenome nome do comprador cadastrado na plataforma

***

**event.payer.document** `string`

Representa o documento de identificação do comprador utilizado no momento da compra, podendo ser do tipo CPF, CNPJ ou nulo

***

**event.payer.email** `string`

Email do comprador cadastrado na plataforma utilizado no momento da compra

***

**event.payer.phone** `string`

Telefone com DDI e DDD do comprador cadastrado na plataforma utilizado no momento da compra

***

**event.invoice.billingAddress** `object`

Representa as informações de endereço capturadas do comprador no momento da compra, essas informações são opcionais dependendo da configuração dos campos obrigatórios no checkout.

***

**event.invoice.billingAddress.countryCode** `string`

Código do país seguindo o ISO 3166-1 alpha-2

***

**event.invoice.billingAddress.state** `string`

Nome do estado, condado, província ou região

***

**event.invoice.billingAddress.city** `string`

Nome da cidade, distrito, subúrbio, vila ou vila

***

**event.invoice.billingAddress.** `string`

Nome do bairro

***

**event.invoice.billingAddress.street** `string`

Nome da rua

***

**event.invoice.billingAddress.number** `string`

O número do imóvel

***

**event.invoice.billingAddress.complement** `string`

Complemento que pode ajudar a encontrar o endereço

***

**event.invoice.billingAddress.postalCode** `string`

CEP / Código Postal

***

**event.invoice.currency** `string`

Moeda em que o comprador foi cobrado (moeda de apresentação), no padrão ISO 4217. É a moeda de todos os valores de `event.invoice.amount`, exceto os de `amount.settlement`.

***

**event.invoice.receivers\[].currency** `string`

Moeda em que o `totalCents` daquele receiver está denominado, no padrão ISO 4217. Sempre enviado. Numa venda internacional é a moeda de liquidação (ex.: `USD`); numa venda nacional é a mesma de `event.invoice.currency` (ex.: `BRL`). Veja [Vendas internacionais](#vendas-internacionais).

***

**event.invoice.amount.settlement** `object`

Composição do valor na moeda de liquidação, congelada na criação da fatura. É o valor bruto que o split divide — portanto, é contra o `totalCents` daqui que a soma de `receivers[].totalCents` fecha. **Não é enviado** em vendas na mesma moeda, em que `event.invoice.amount` já é a composição da liquidação.

***

**event.invoice.amount.settlement.subtotalCents** `number`

Subtotal na moeda de liquidação, em centavos

***

**event.invoice.amount.settlement.taxAmountCents** `number`

Impostos recolhidos na venda, na moeda de liquidação, em centavos

***

**event.invoice.amount.settlement.totalCents** `number`

Total na moeda de liquidação, em centavos. É o valor que a soma dos receivers reproduz

***

**event.invoice.amount.settlement.currency** `string`

Moeda de liquidação, no padrão ISO 4217

***

**event.invoice.currencyConversion** `object`

Conversão de moeda travada para esta venda, que permite auditar os valores de liquidação contra a taxa que os produziu. **Não é enviado** em vendas na mesma moeda, que não passam por conversão.

***

**event.invoice.currencyConversion.presentmentCurrency** `string`

Moeda em que o comprador foi cobrado. É a mesma de `event.invoice.currency`

***

**event.invoice.currencyConversion.settlementCurrency** `string`

Moeda em que a venda foi liquidada. É a mesma de `event.invoice.receivers[].currency`

***

**event.invoice.currencyConversion.rate** `number`

Multiplicador da conversão, aplicado como `liquidação = apresentação × rate`. **Não é um percentual** e, em alguns pares de moedas, é legitimamente maior que 100. Enviado sem arredondamento

***

**event.invoice.currencyConversion.rateAt** `string`

Momento em que a taxa foi capturada, segue o padrão de ISO-8601 com UTC 0. Opcional

***

**event.user** `object`

Representa as informações de usuário cadastradas na plataforma

***

**event.user.id** `string`

Identificador único do usuário cadastrado na plataforma

***

**event.user.firstName** `string`

Primeiro nome do usuário cadastrado na plataforma

***

**event.user.lastName** `string`

Sobrenome nome do usuário cadastrado na plataforma

***

**event.user.document** `string`

Representa o documento de identificação do usuário, podendo ser do tipo CPF, CNPJ ou nulo

***

**event.user.email** `string`

Email do usuário cadastrado na plataforma

***

**event.user.phone** `string`

Telefone com DDI e DDD do usuário cadastrado na plataforma
{% endtab %}
{% endtabs %}
