# 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)

***

### Fatura criada

Evento disparado quando uma fatura é criada com sucesso e já está disponível para pagamento.

{% 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",
      "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": "draft",
      "statusAt": [],
      "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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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": 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 disparado quando uma fatura tem o status atualizado com sucesso.

{% 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",
      "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": "unpaid",
      "statusAt": [
        {
          "status": "unpaid",
          "when": "2024-03-28T20:35:22.671Z"
        }
      ],
      "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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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 %}

{% tab title="Expirado" %}
```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",
      "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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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-29T20:35:33.512Z
      ]
      ",
      "version": 6
    },
    "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",
      "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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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.512Z",
      "version": 8
    },
    "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",
      "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": "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"
        }
      ],
      "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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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-28T21:47:53.177Z",
      "version": 9
    },
    "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",
      "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": "disputed",
      "statusAt": [
        {
          "status": "unpaid",
          "when": "2024-03-28T20:35:22.671Z"
        },
        {
          "status": "paid",
          "when": "2024-03-28T20:35:33.512Z"
        },
        {
          "status": "disputed",
          "when": "2024-03-28T21:04:34.720Z"
        }
      ],
      "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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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-28T21:04:34.721Z",
      "version": 8
    },
    "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",
      "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": "chargeback",
      "statusAt": [
        {
          "status": "unpaid",
          "when": "2024-03-28T20:35:22.671Z"
        },
        {
          "status": "paid",
          "when": "2024-03-28T20:35:33.512Z"
        },
        {
          "status": "disputed",
          "when": "2024-03-28T21:04:34.720Z"
        },
        {
          "status": "chargeback",
          "when": "2024-03-28T22:38:34.720Z"
        }
      ],
      "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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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-28T22:38:34.720Z",
      "version": 9
    },
    "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

Evento disparado quando uma fatura é paga com sucesso.

{% 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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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

Evento disparado quando uma fatura apenas com o método de pagamento sendo Cartão de Crédito efetua tentativa de cobrança e falha.

{% 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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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

Evento disparado quando uma fatura não foi paga até a data de vencimento.

{% 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",
      "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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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-29T20:35:33.512Z",
      "version": 6
    },
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```
{% endtab %}
{% endtabs %}

***

### Fatura reembolsada

Evento disparado quando uma fatura que estava paga é reembolsada com sucesso.

{% 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",
      "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": "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"
        }
      ],
      "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
        },
        {
          "id": "onVILjt4hEhXIdCrvCXBUpcBuvk2",
          "name": "Victor Lott",
          "email": "lott@hub.la",
          "phone": "+5533988891169",
          "role": "seller",
          "paysForFees": true,
          "totalCents": 86542
        }
      ],
      "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-28T21:47:53.177Z",
      "version": 9
    },
    "user": {
      "id": "J0kmLJmCj1TO4m3pqW0GDlEjROQ2",
      "firstName": "John",
      "lastName": "Doe",
      "document": "12345678900",
      "email": "johndoe.user@example.com",
      "phone": "+5511999999999"
    }
  },
  "version": "2.0.0"
}
```
{% endtab %}
{% endtabs %}

## 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.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 %}
