Próxima Fatura
curl --request GET \
--url https://api.billing.upag.io/v1/invoices/upcoming \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.billing.upag.io/v1/invoices/upcoming', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.billing.upag.io/v1/invoices/upcoming';
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
Próxima Fatura
Retorna a prévia da próxima fatura de uma assinatura
GET
https://api.billing.upag.io
/
v1
/
invoices
/
upcoming
Próxima Fatura
curl --request GET \
--url https://api.billing.upag.io/v1/invoices/upcoming \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.billing.upag.io/v1/invoices/upcoming', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.billing.upag.io/v1/invoices/upcoming';
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 a prévia da próxima cobrança para uma assinatura (período, itens e valor total). Útil para exibir ao cliente o valor da próxima renovação.
Endpoint
cURL
curl -G https://api.billing.upag.io/v1/invoices/upcoming \
-H "Authorization: Bearer {token}" \
-d subscription=sub_abc123xyz
Parâmetros
string
required
ID da assinatura (
sub_...) usado para calcular a próxima fatura.Resposta
Objeto de prévia (não é uma fatura persistida). Inclui período de cobrança previsto, cliente, moeda, itens derivados da assinatura eamountDue total.
Response
{
"subscriptionId": "sub_abc123xyz",
"customerId": "cus_ahwDXrgYvur89iPs",
"currency": "BRL",
"periodStart": "2024-12-15T10:00:00.000Z",
"periodEnd": "2025-01-15T10:00:00.000Z",
"amountDue": 9900,
"items": [
{
"productId": "prod_xyz789abc",
"priceId": "price_def456ghi",
"name": "Plano Pro",
"amount": 9900,
"quantity": 1,
"total": 9900
}
]
}