Atualizar sessão de checkout
curl --request PATCH \
--url https://api.upag.io/v1/checkout/sessions/{sessionId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": {},
"paymentMethods": [
{}
],
"successUrl": {},
"cancelUrl": {}
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer: {}, paymentMethods: [{}], successUrl: {}, cancelUrl: {}})
};
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: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer: {}, paymentMethods: [{}], successUrl: {}, cancelUrl: {}})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Sessões de checkout
Atualizar sessão de checkout
Altera cliente, métodos de pagamento ou URLs de uma sessão aberta
PATCH
https://api.upag.io
/
v1
/
checkout
/
sessions
/
{sessionId}
Atualizar sessão de checkout
curl --request PATCH \
--url https://api.upag.io/v1/checkout/sessions/{sessionId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": {},
"paymentMethods": [
{}
],
"successUrl": {},
"cancelUrl": {}
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer: {}, paymentMethods: [{}], successUrl: {}, cancelUrl: {}})
};
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: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer: {}, paymentMethods: [{}], successUrl: {}, cancelUrl: {}})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Altera uma sessão
open. Os campos omitidos mantêm o valor; null limpa o cliente ou uma URL. Itens, bumps e teste não mudam: para isso, crie outra sessão.
Permissão: checkout_session.write. 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 -X PATCH https://api.upag.dev/v1/checkout/sessions/4f9d2b71-6c03-4e58-9a1d-8b3e7c0f5a26 \
-H "Authorization: Bearer sk_test_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"paymentMethods": ["card"],
"successUrl": "https://exemplo.com.br/pedido/concluido"
}'
import { Upag } from 'upag';
const upag = new Upag('sk_test_your_api_key');
const session = await upag.checkoutSessions.update('4f9d2b71-6c03-4e58-9a1d-8b3e7c0f5a26', {
paymentMethods: ['card'],
successUrl: 'https://exemplo.com.br/pedido/concluido',
});
Parâmetros
string (uuid)
required
ID da sessão.
array
pix e/ou card, mínimo 1. Numa sessão com teste e paymentMethodCollection: "always", card precisa continuar na lista.string (url) | null
URL de retorno depois do pagamento.
null remove.string (url) | null
URL de retorno se o pagador desistir.
null remove.Resposta
200 OK com a sessão atualizada.
Response
{
"id": "4f9d2b71-6c03-4e58-9a1d-8b3e7c0f5a26",
"customer": "8c1f0a26-5d3b-4f1e-9c72-1a4e6b9d0f83",
"checkoutLayout": null,
"paymentLink": null,
"paymentMethods": ["card"],
"subscriptionData": {
"trial": null,
"trialEnd": null,
"trialSettings": {
"endBehavior": { "missingPaymentMethod": "create_invoice" }
}
},
"paymentMethodCollection": "always",
"status": "open",
"url": "https://checkout.upag.io/cs/4f9d2b71-6c03-4e58-9a1d-8b3e7c0f5a26",
"expiresAt": "2026-10-08T19:00:00.000Z",
"createdAt": "2026-10-07T19:00:00.000Z",
"updatedAt": "2026-10-07T19:10:00.000Z",
"billingAddressCollection": "auto",
"successUrl": "https://exemplo.com.br/pedido/concluido",
"cancelUrl": "https://exemplo.com.br/carrinho",
"latitude": null,
"longitude": null,
"country": null,
"region": null,
"city": null,
"invoice": null,
"subscription": null,
"couponEnabled": true,
"couponCode": null,
"items": [
{
"id": "b7e1c4a9-3d52-4f08-86a1-2c9d5e7f0b34",
"price": "3a7e9c14-6b2d-4f85-9e10-5c8d2a7b4f61",
"quantity": 1
}
],
"bumps": [],
"discounts": []
}
Erros
| Status | Código | Quando |
|---|---|---|
404 | CHECKOUT_SESSION_NOT_FOUND | A sessão não existe ou é de outra conta |
404 | CUSTOMER_NOT_FOUND | O cliente não existe na conta |
409 | CHECKOUT_SESSION_NOT_OPEN | A sessão já está complete ou expired |
400 | CHECKOUT_SESSION_TRIAL_REQUIRES_CARD | A sessão tem teste com paymentMethodCollection: "always" e card ficaria fora de paymentMethods |
422 | VALIDATION_FAILED | paymentMethods vazio ou URL inválida |