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

# Status da Cobrança

> Endpoint leve para polling de status de pagamento

## Descrição

Retorna apenas o status da cobrança. Ideal para **polling** — verificar periodicamente se um pagamento foi confirmado, sem carregar todos os dados da cobrança.

<Tip>
  Use este endpoint em vez de `GET /charges/{id}` quando precisar verificar o status frequentemente. Ele é mais leve e rápido.
</Tip>

***

## Parâmetros de Path

<ParamField path="chargeId" type="string" required>
  ID da cobrança
</ParamField>

***

## Headers

<ParamField header="Authorization" type="string" required>
  Bearer token de autenticação. Formato: `Bearer sk_live_xxx`
</ParamField>

***

## Exemplo de Requisição

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.flarepayments.com/v1/charges/ch_flare_dc7dc11b7f984d2886d2b429/status \
    -H "Authorization: Bearer sk_live_sua_chave_aqui"
  ```

  ```javascript Node.js theme={null}
  // Polling a cada 3 segundos
  async function aguardarPagamento(chargeId) {
    while (true) {
      const res = await fetch(
        `https://api.flarepayments.com/v1/charges/${chargeId}/status`,
        { headers: { 'Authorization': 'Bearer sk_live_xxx' } }
      );
      const { status, paid } = await res.json();

      if (paid) {
        console.log('Pagamento confirmado!');
        break;
      }
      if (status === 'expired' || status === 'failed') {
        console.log('Cobrança expirou ou falhou');
        break;
      }

      await new Promise(r => setTimeout(r, 3000));
    }
  }
  ```
</CodeGroup>

***

## Resposta `200 OK`

<ResponseField name="id" type="string">
  ID da cobrança
</ResponseField>

<ResponseField name="status" type="string">
  Status atual: `pending`, `paid`, `expired`, `failed`
</ResponseField>

<ResponseField name="paid" type="boolean">
  `true` se o pagamento foi confirmado
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "ch_flare_dc7dc11b7f984d2886d2b429",
    "status": "pending",
    "paid": false
  }
  ```
</ResponseExample>
