Obter fatura
curl --request GET \
--url https://api.upag.io/v1/invoices/{invoiceId} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.upag.io/v1/invoices/{invoiceId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/invoices/{invoiceId}';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Faturas
Obter fatura
Consulta uma fatura com itens, descontos e pagamentos
GET
https://api.upag.io
/
v1
/
invoices
/
{invoiceId}
Obter fatura
curl --request GET \
--url https://api.upag.io/v1/invoices/{invoiceId} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.upag.io/v1/invoices/{invoiceId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/invoices/{invoiceId}';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Retorna uma fatura com seus itens, descontos e as tentativas de pagamento (
payments).
Permissão: invoice.read. Apenas chave secreta (sk_…).
Os exemplos usam o sandbox (
https://api.upag.dev/v1). Em produção use https://api.upag.io/v1 com sk_live_….Endpoint
curl https://api.upag.dev/v1/invoices/5b0e8d3a-9c71-4e26-a8f4-1d7c3b6e9a02 \
-H "Authorization: Bearer sk_test_your_api_key"
import { Upag } from 'upag';
const upag = new Upag('sk_test_your_api_key');
const invoice = await upag.invoices.retrieve('5b0e8d3a-9c71-4e26-a8f4-1d7c3b6e9a02');
Parâmetros
string (uuid)
required
ID da fatura.
Resposta
200 OK
Response
{
"id": "5b0e8d3a-9c71-4e26-a8f4-1d7c3b6e9a02",
"customer": "8c1f0a26-5d3b-4f1e-9c72-1a4e6b9d0f83",
"paymentMethod": null,
"subscription": null,
"status": "paid",
"currency": "brl",
"description": "Consultoria de setembro",
"amountDue": 9900,
"amountPaid": 9900,
"attemptCount": 0,
"dueDate": "2026-10-20T00:00:00.000Z",
"paidAt": "2026-10-07T19:05:12.000Z",
"items": [
{
"id": "e4a1c7f8-2b95-4d03-8e6a-9f1b5d0c3a74",
"product": "7d2b5e90-1c34-4a68-b9f7-0e3a6c8d1f25",
"price": "3a7e9c14-6b2d-4f85-9e10-5c8d2a7b4f61",
"name": "Plano mensal",
"amount": 4950,
"quantity": 2,
"totalAmount": 9900
}
],
"discounts": [],
"payments": [
{
"charge": "1f7d3c8a-4b52-4c9e-8a11-6d0e2f5b7c34",
"type": "pix",
"status": "paid",
"settledAt": "2026-10-07T19:05:12.000Z",
"createdAt": "2026-10-07T19:01:30.000Z"
}
],
"createdAt": "2026-10-07T19:00:00.000Z",
"updatedAt": "2026-10-07T19:05:12.000Z"
}
payments[].charge é o UUID da cobrança. Para ver o QR code Pix ou os dados do cartão, consulte-a em Obter cobrança.
Erros
| Status | Código | Quando |
|---|---|---|
404 | INVOICE_NOT_FOUND | A fatura não existe ou é de outra conta |