Obter sessão (pagador)
curl --request GET \
--url https://api.upag.io/v1/checkout/sessions/{sessionId} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "<string>",
"status": "<string>",
"url": {},
"paymentLink": {},
"expiresAt": {},
"createdAt": "<string>",
"updatedAt": "<string>",
"currency": "<string>",
"subtotal": 123,
"discountAmount": 123,
"amount": 123,
"items": [
{}
],
"bumps": [
{}
],
"discounts": [
{}
],
"couponEnabled": true,
"couponCode": {},
"billingAddressCollection": "<string>",
"trial": {},
"paymentMethodCollection": "<string>",
"successUrl": {},
"cancelUrl": {},
"layout": {},
"paymentMethods": [
{}
],
"customer": {},
"charge": {},
"invoice": {},
"clientSecret": {},
"account": {}
}
'const options = {
method: 'GET',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: '<string>',
status: '<string>',
url: {},
paymentLink: {},
expiresAt: {},
createdAt: '<string>',
updatedAt: '<string>',
currency: '<string>',
subtotal: 123,
discountAmount: 123,
amount: 123,
items: [{}],
bumps: [{}],
discounts: [{}],
couponEnabled: true,
couponCode: {},
billingAddressCollection: '<string>',
trial: {},
paymentMethodCollection: '<string>',
successUrl: {},
cancelUrl: {},
layout: {},
paymentMethods: [{}],
customer: {},
charge: {},
invoice: {},
clientSecret: {},
account: {}
})
};
fetch('https://api.upag.io/v1/checkout/sessions/{sessionId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/checkout/sessions/{sessionId}';
const options = {
method: 'GET',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: '<string>',
status: '<string>',
url: {},
paymentLink: {},
expiresAt: {},
createdAt: '<string>',
updatedAt: '<string>',
currency: '<string>',
subtotal: 123,
discountAmount: 123,
amount: 123,
items: [{}],
bumps: [{}],
discounts: [{}],
couponEnabled: true,
couponCode: {},
billingAddressCollection: '<string>',
trial: {},
paymentMethodCollection: '<string>',
successUrl: {},
cancelUrl: {},
layout: {},
paymentMethods: [{}],
customer: {},
charge: {},
invoice: {},
clientSecret: {},
account: {}
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Sessões de checkout
Obter sessão (pagador)
Recarrega a sessão no navegador com o clientSecret e descreve a visão do pagador
GET
https://api.upag.io
/
v1
/
checkout
/
sessions
/
{sessionId}
Obter sessão (pagador)
curl --request GET \
--url https://api.upag.io/v1/checkout/sessions/{sessionId} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "<string>",
"status": "<string>",
"url": {},
"paymentLink": {},
"expiresAt": {},
"createdAt": "<string>",
"updatedAt": "<string>",
"currency": "<string>",
"subtotal": 123,
"discountAmount": 123,
"amount": 123,
"items": [
{}
],
"bumps": [
{}
],
"discounts": [
{}
],
"couponEnabled": true,
"couponCode": {},
"billingAddressCollection": "<string>",
"trial": {},
"paymentMethodCollection": "<string>",
"successUrl": {},
"cancelUrl": {},
"layout": {},
"paymentMethods": [
{}
],
"customer": {},
"charge": {},
"invoice": {},
"clientSecret": {},
"account": {}
}
'const options = {
method: 'GET',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: '<string>',
status: '<string>',
url: {},
paymentLink: {},
expiresAt: {},
createdAt: '<string>',
updatedAt: '<string>',
currency: '<string>',
subtotal: 123,
discountAmount: 123,
amount: 123,
items: [{}],
bumps: [{}],
discounts: [{}],
couponEnabled: true,
couponCode: {},
billingAddressCollection: '<string>',
trial: {},
paymentMethodCollection: '<string>',
successUrl: {},
cancelUrl: {},
layout: {},
paymentMethods: [{}],
customer: {},
charge: {},
invoice: {},
clientSecret: {},
account: {}
})
};
fetch('https://api.upag.io/v1/checkout/sessions/{sessionId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/checkout/sessions/{sessionId}';
const options = {
method: 'GET',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: '<string>',
status: '<string>',
url: {},
paymentLink: {},
expiresAt: {},
createdAt: '<string>',
updatedAt: '<string>',
currency: '<string>',
subtotal: 123,
discountAmount: 123,
amount: 123,
items: [{}],
bumps: [{}],
discounts: [{}],
couponEnabled: true,
couponCode: {},
billingAddressCollection: '<string>',
trial: {},
paymentMethodCollection: '<string>',
successUrl: {},
cancelUrl: {},
layout: {},
paymentMethods: [{}],
customer: {},
charge: {},
invoice: {},
clientSecret: {},
account: {}
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Recarrega a sessão como a página de checkout a enxerga, autenticada com o
clientSecret recebido em Iniciar sessão: itens com preço e produto, valores a pagar hoje, opções de parcelamento, teste, cupom e, depois da confirmação, a cobrança.
É a visão do pagador, a mesma de Iniciar, Confirmar e dos cupons. Com a chave secreta, a mesma URL devolve a estrutura do servidor.
Permissão: checkout_session.read. O clientSecret só alcança a sessão da própria rota; qualquer outro erro de credencial responde 401 sem detalhes.
Os exemplos usam o sandbox (
https://api.upag.dev/v1). Em produção use https://api.upag.io/v1 com sk_live_…; no navegador, o upag-js usa só a chave pública.Endpoint
curl https://api.upag.dev/v1/checkout/sessions/4f9d2b71-6c03-4e58-9a1d-8b3e7c0f5a26 \
-H "Authorization: Bearer Zk3v0pQ8xJ2mR7cYt1LwN5dHs9uAeB4gXo6iFqVjT0E"
import { UpagJs } from 'upag-js';
const upag = new UpagJs('pk_test_your_public_key');
const session = await upag.checkout.retrieve(id, clientSecret);
Parâmetros
string (uuid)
required
ID da sessão.
string
required
Bearer <clientSecret>.Resposta
200 OK
Response
{
"id": "4f9d2b71-6c03-4e58-9a1d-8b3e7c0f5a26",
"status": "open",
"url": "https://checkout.upag.io/cs/4f9d2b71-6c03-4e58-9a1d-8b3e7c0f5a26",
"paymentLink": "c3f81a5e-2b94-4d70-a6e3-9d0b7c1f4a58",
"expiresAt": "2026-10-08T19:00:00.000Z",
"createdAt": "2026-10-07T19:00:00.000Z",
"updatedAt": "2026-10-07T19:02:30.000Z",
"currency": "brl",
"subtotal": 19900,
"discountAmount": 1990,
"amount": 17910,
"items": [
{
"id": "b7e1c4a9-3d52-4f08-86a1-2c9d5e7f0b34",
"quantity": 1,
"price": {
"id": "3a7e9c14-6b2d-4f85-9e10-5c8d2a7b4f61",
"name": "Curso de Culinária",
"billingType": "one_time",
"interval": null,
"intervalCount": null,
"currency": "brl",
"amount": 19900,
"product": {
"id": "7d2b5e90-1c34-4a68-b9f7-0e3a6c8d1f25",
"name": "Curso de Culinária",
"description": "12 aulas em vídeo",
"image": null
}
}
}
],
"bumps": [],
"discounts": [
{
"id": "0d6f3a82-5e19-4b47-a3c8-7f1b9e2d4c60",
"item": "b7e1c4a9-3d52-4f08-86a1-2c9d5e7f0b34",
"coupon": "a58c2e14-9d70-4f36-b1e5-3c8a6d0f7b92",
"type": "coupon",
"amount": 1990
}
],
"couponEnabled": true,
"couponCode": "BEMVINDO10",
"billingAddressCollection": "auto",
"trial": null,
"paymentMethodCollection": "always",
"successUrl": "https://exemplo.com.br/obrigado",
"cancelUrl": "https://exemplo.com.br/carrinho",
"layout": null,
"paymentMethods": [
{
"type": "card",
"interestRate": 2.99,
"installments": [
{ "count": 1, "amount": 17910, "total": 17910 },
{ "count": 2, "amount": 9055, "total": 18110 }
]
},
{
"type": "pix",
"interestRate": 0,
"installments": [{ "count": 1, "amount": 17910, "total": 17910 }]
}
],
"customer": null,
"charge": null,
"invoice": null,
"clientSecret": null,
"account": {
"displayName": "Loja Exemplo",
"legalName": "Loja Exemplo Ltda",
"publishableKey": "pk_test_your_public_key",
"threeDSecureEnabled": false
}
}
Atributos
string
UUID da sessão.
string
open, complete ou expired.string | null
Endereço da página de checkout hospedada.
string | null
UUID do link de pagamento de origem.
string | null
ISO 8601 do vencimento.
string
ISO 8601.
string
ISO 8601.
string
Moeda dos itens (
brl ou usd).integer
O que os itens custam hoje, em centavos. Itens recorrentes sob um teste ainda não são cobrados e não entram. Bumps não entram.
integer
Soma dos descontos do cupom, em centavos.
integer
subtotal - discountAmount, nunca negativo, em centavos. É 0 quando um teste cobre todos os itens. Não inclui bumps nem juros de parcelamento.array
Itens da sessão.
id: UUID do item.quantity: quantidade.price:id,name,billingType(one_timeourecurring),interval,intervalCount,currency,amount(centavos) eproduct(id,name,description,image).
array
Ofertas extras. Cada uma tem
id, quantity, amount (centavos), title, description e price (mesmo formato dos itens). O pagador aceita as que quiser enviando os id em bumps na confirmação.array
Descontos de cupom:
id, item, coupon, type (coupon) e amount (centavos).string | null
Cupom aplicado.
string
auto, required ou none.object | null
Presente só quando a sessão tem teste e um item recorrente. Veja Teste grátis.
interval:day,weekoumonth;nullquando o teste é uma data fixa.intervalCount: duração;nullquando é uma data fixa.endsAt: ISO 8601. Antes da conclusão é uma prévia, como se a assinatura fosse criada agora. Depois, é o fim real do teste.
string
always ou if_required.string | null
URL de retorno depois do pagamento.
string | null
URL de retorno se o pagador desistir.
object | null
Aparência da página:
theme, favicon, desktop e mobile. null sem layout.array
Métodos que a conta tem ativados, com o cartão primeiro.
type:cardoupix.interestRate: juros do parcelamento para o pagador, em percentual, medidos na parcela de 2x.0no Pix e quando os juros não são do pagador.installments: opções{ count, amount, total }.totalé o que será cobrado (em centavos);amounté a primeira parcela e as demais sãofloor(total / count). O Pix só temcount: 1.
installments: []) se paymentMethodCollection é always, e vem vazia com if_required.object | null
Pagador, depois que a sessão foi confirmada:
id, name, email, document (type e number mascarado) e, quando existirem, phone (mascarado) e address.object | null
Última tentativa de pagamento:
id, type, status, amount (centavos, já com juros), interestAmount, installments, paidAt, card (brand e last4, só cartão), pix (copyPaste e expiresAt, só Pix), error (code e message quando falhou) e nextAction (sempre null). null antes da primeira tentativa.object | null
Fatura criada pela primeira confirmação:
id e status. null antes dela e quando nada foi cobrado hoje.string | null
Só vem preenchido em Iniciar sessão. Aqui é sempre
null.object
Dados da conta para a página:
displayName, legalName, publishableKey (para tokenizar cartões) e threeDSecureEnabled (se a autenticação 3D Secure está disponível).Erros
| Status | Código | Quando |
|---|---|---|
401 | n/a | clientSecret ausente, errado ou de outra sessão (a resposta é a mesma nos três casos) |