Skip to main content

GET /v1/charges

Retorna as cobranças do merchant autenticado, ordenadas da mais recente para a mais antiga. Suporta paginação e filtro por status. Os resultados são cacheados por alguns segundos para otimizar a performance. Em caso de alta frequência de consultas, considere usar webhooks para receber atualizações em tempo real.

Request

GET https://api.liquera.com.br/v1/charges
Authorization: Bearer <jwt_ou_api_key>

Query parameters

page
integer
Número da página. Começa em 1. Padrão: 1.
limit
integer
Número de cobranças por página. Mínimo: 1. Máximo: 100. Padrão: 20.
status
string
Filtrar por status. Valores aceitos: PENDING, PAID, FAILED, CANCELED, REFUNDED. Se não informado, retorna cobranças de todos os status.

Exemplos

# Todas as cobranças (primeira página)
curl "https://api.liquera.com.br/v1/charges" \
  -H "Authorization: Bearer lk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

# Cobranças pagas, página 2
curl "https://api.liquera.com.br/v1/charges?status=PAID&page=2&limit=50" \
  -H "Authorization: Bearer lk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

# Cobranças pendentes
curl "https://api.liquera.com.br/v1/charges?status=PENDING" \
  -H "Authorization: Bearer lk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Response

page
integer
Página atual.
limit
integer
Limite por página.
total
integer
Total de cobranças (considerando o filtro de status aplicado).
charges
array
Lista de cobranças.
{
  "page": 1,
  "limit": 20,
  "total": 2,
  "charges": [
    {
      "id": "clx3ghi789",
      "txid": "a1b2c3d4e5f67890abcdef1234567890",
      "qrCode": "00020126580014br.gov.bcb.pix0136...",
      "amount": 9990,
      "description": "Pedido #1234",
      "status": "PAID",
      "expiresIn": 86400,
      "paidAt": "2025-01-15T14:22:00.000Z",
      "createdAt": "2025-01-15T10:30:00.000Z",
      "customer": {
        "id": "clx0cus111",
        "name": "João Silva",
        "document": "12345678901"
      }
    },
    {
      "id": "clx4jkl012",
      "txid": "b2c3d4e5f6789012bcdef23456789012",
      "qrCode": "00020126580014br.gov.bcb.pix0136...",
      "amount": 5000,
      "description": "Pedido #1235",
      "status": "PENDING",
      "expiresIn": 3600,
      "paidAt": null,
      "createdAt": "2025-01-15T11:00:00.000Z",
      "customer": null
    }
  ]
}

Calculando páginas

Para navegar por todos os resultados, use total, page e limit:
const totalPages = Math.ceil(total / limit);
const hasNextPage = page < totalPages;