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

# payment.failed

> Evento emitido após falha de pagamento

`payment.failed` é emitido depois que um [Payment](/data-modelling/billing/payment) falha.

Handlers usam este evento para executar efeitos assíncronos fora do fluxo síncrono.

## Detalhes do Evento

| Propriedade    | Valor                      |
| -------------- | -------------------------- |
| **Tipo**       | `payment.failed`           |
| **Origem**     | Atualização de Payment     |
| **Publicação** | Após commit do Payment     |
| **Quando**     | `status = PAYMENT_FAILED`. |

## Handlers

| Handler                       | Responsabilidade          | Dados usados | Execução    |
| ----------------------------- | ------------------------- | ------------ | ----------- |
| `send-payment-failed-message` | Avisa falha de pagamento. | `data`       | Assíncrona. |

## Payload

| Campo  | Tipo      | Descrição                  |
| ------ | --------- | -------------------------- |
| `data` | `Payment` | Entidade Payment com falha |

## Regras dos handlers

* Handlers não rodam na transação que publicou o Payment.
* Falha em handler não desfaz o Payment.
* Cada handler deve ser idempotente.
* Novos handlers podem ser adicionados sem mudar o fluxo síncrono.

## Exemplo

```json theme={null}
{
  "type": "payment.failed",
  "data": {
    "paymentId": "0197a816-281b-72e7-8f50-286fbfc5c08d",
    "orderId": "0197a813-0fb9-7d42-9c81-50c0f6d9ae5a",
    "organizationId": "0197a801-1690-7590-b3cf-19599b9be3e4",
    "companyId": "0197a801-6a42-79aa-9e56-d3c85148c0fa",
    "externalProvider": "billing_interface",
    "externalProviderId": "pay_4a817c90",
    "description": "Pedido OAB-20260703-0001",
    "method": "PIX",
    "channel": "ONLINE",
    "card": null,
    "pix": {
      "qrCode": "00020101021226860014br.gov.bcb.pix2564pix.example.com/charge/pay_4a817c90",
      "expiresAt": "2026-07-03T16:30:00.000Z"
    },
    "amount": 11400,
    "dueDate": "2026-07-03T16:30:00.000Z",
    "status": "PAYMENT_FAILED",
    "issuedAt": "2026-07-03T16:00:30.000Z",
    "paidAt": null,
    "overdueAt": null,
    "canceledBy": null,
    "canceledAt": null,
    "createdBy": "0197a805-0910-7eb2-bae7-90a13df2a9b2",
    "createdAt": "2026-07-03T16:00:30.000Z",
    "updatedBy": "0197a805-0910-7eb2-bae7-90a13df2a9b2",
    "updatedAt": "2026-07-03T16:02:00.000Z"
  }
}
```
