Pagamentos
Upsell e downsell
Cria uma nova venda (upsell ou downsell) a partir de uma transação já paga.
POST
/public/v1/payments/upsellO cliente, o webhook e o cartão tokenizado (one-click) são reutilizados da transação de referência, então o payload é mínimo. Upsell e downsell usam o mesmo endpoint e diferem apenas pelo valor e pelos itens enviados.
Regras
Campos do corpo
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
transaction_reference |
string | Sim | Hash da transação original paga. |
upsell_page_url |
string (URL) | Sim | Link da página de upsell/downsell exibida ao cliente. Passa por validação antifraude. |
payment_method |
string | Sim | pix ou credit_card. |
amount |
inteiro | Sim | Valor total em centavos (mín. 1). |
installments |
inteiro | Se credit_card |
Mín. 1, máx. 12. |
items |
array | Sim | Lista com ao menos 1 item (hash, title, price em centavos, quantity). |
Exemplo de requisição com PIX
curl -X POST "https://api.cloud.unicopag.com.br/public/v1/payments/upsell?api_token=SEU_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"transaction_reference": "abc123xyz0",
"upsell_page_url": "https://checkout.seuloja.com/upsell/oferta",
"payment_method": "pix",
"amount": 9900,
"items": [
{
"hash": "produto-upsell",
"title": "Produto Upsell",
"price": 9900,
"quantity": 1
}
]
}'<?php
$ch = curl_init('https://api.cloud.unicopag.com.br/public/v1/payments/upsell?api_token=SEU_API_TOKEN');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Accept: application/json', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'transaction_reference' => 'abc123xyz0',
'upsell_page_url' => 'https://checkout.seuloja.com/upsell/oferta',
'payment_method' => 'pix',
'amount' => 9900,
'items' => [
[
'hash' => 'produto-upsell',
'title' => 'Produto Upsell',
'price' => 9900,
'quantity' => 1,
],
],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://api.cloud.unicopag.com.br/public/v1/payments/upsell?api_token=SEU_API_TOKEN', {
method: 'POST',
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({
"transaction_reference": "abc123xyz0",
"upsell_page_url": "https://checkout.seuloja.com/upsell/oferta",
"payment_method": "pix",
"amount": 9900,
"items": [
{
"hash": "produto-upsell",
"title": "Produto Upsell",
"price": 9900,
"quantity": 1
}
]
}),
});
const data = await response.json();import requests
response = requests.post(
"https://api.cloud.unicopag.com.br/public/v1/payments/upsell?api_token=SEU_API_TOKEN",
headers={"Accept": "application/json"},
json={
"transaction_reference": "abc123xyz0",
"upsell_page_url": "https://checkout.seuloja.com/upsell/oferta",
"payment_method": "pix",
"amount": 9900,
"items": [
{
"hash": "produto-upsell",
"title": "Produto Upsell",
"price": 9900,
"quantity": 1,
},
],
},
)
data = response.json()Exemplo de requisição com cartão (one-click)
curl -X POST "https://api.cloud.unicopag.com.br/public/v1/payments/upsell?api_token=SEU_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"transaction_reference": "abc123xyz0",
"upsell_page_url": "https://checkout.seuloja.com/upsell/oferta",
"payment_method": "credit_card",
"amount": 9900,
"installments": 3,
"items": [
{
"hash": "produto-upsell",
"title": "Produto Upsell",
"price": 9900,
"quantity": 1
}
]
}'<?php
$ch = curl_init('https://api.cloud.unicopag.com.br/public/v1/payments/upsell?api_token=SEU_API_TOKEN');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Accept: application/json', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'transaction_reference' => 'abc123xyz0',
'upsell_page_url' => 'https://checkout.seuloja.com/upsell/oferta',
'payment_method' => 'credit_card',
'amount' => 9900,
'installments' => 3,
'items' => [
[
'hash' => 'produto-upsell',
'title' => 'Produto Upsell',
'price' => 9900,
'quantity' => 1,
],
],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://api.cloud.unicopag.com.br/public/v1/payments/upsell?api_token=SEU_API_TOKEN', {
method: 'POST',
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({
"transaction_reference": "abc123xyz0",
"upsell_page_url": "https://checkout.seuloja.com/upsell/oferta",
"payment_method": "credit_card",
"amount": 9900,
"installments": 3,
"items": [
{
"hash": "produto-upsell",
"title": "Produto Upsell",
"price": 9900,
"quantity": 1
}
]
}),
});
const data = await response.json();import requests
response = requests.post(
"https://api.cloud.unicopag.com.br/public/v1/payments/upsell?api_token=SEU_API_TOKEN",
headers={"Accept": "application/json"},
json={
"transaction_reference": "abc123xyz0",
"upsell_page_url": "https://checkout.seuloja.com/upsell/oferta",
"payment_method": "credit_card",
"amount": 9900,
"installments": 3,
"items": [
{
"hash": "produto-upsell",
"title": "Produto Upsell",
"price": 9900,
"quantity": 1,
},
],
},
)
data = response.json()Resposta de sucesso (200)
{
"event": "transaction.created",
"id": "novaHash10",
"hash": "novaHash10",
"payment_method": "pix",
"payment_status": "waiting_payment",
"installments": 1,
"amount": 9900,
"amount_discount": 0,
"amount_shipping": 0,
"amount_interest": 0,
"amount_total": 9900,
"customer": {
"hash": "...",
"name": "Cliente Exemplo",
"email": "cliente@email.com",
"document": "00000000000"
},
"items": [
{
"hash": "produto-upsell",
"title": "Produto Upsell",
"price": 9900,
"quantity": 1,
"operation_type": "sale"
}
],
"pix": {
"pix_url": null,
"pix_qr_code": "...",
"pix_base64": "..."
},
"billet": null,
"postback_url": "https://seu-webhook.com/callback",
"paid_at": null,
"created_at": "2026-07-14 16:30:00",
"updated_at": "2026-07-14 16:30:00",
"card_brand": null
}No cartão, pix vem null e card_brand pode vir preenchido. O formato é o mesmo de POST /public/v1/payments.
Erro de validação (422)
{
"message": "The given data was invalid.",
"errors": {
"upsell_page_url": [
"A URL da página de upsell é obrigatória."
]
}
}Antifraude da página
A upsell_page_url é verificada antes de processar o pagamento:
- A URL precisa ser acessível publicamente.
- O conteúdo da página é analisado para confirmar que se trata de uma oferta/upsell legítima.
- Se a página for considerada inválida ou inacessível, a cobrança é rejeitada (
400).
{
"message": "Tentativa de upsell rejeitada pelo antifraude",
"reason": "Página sem evidência de oferta de upsell."
}Outros erros
| Status | Motivo |
|---|---|
404 |
Transação de referência não encontrada (hash inexistente ou de outra conta). |
400 |
A transação de referência precisa estar paga. |
400 |
Não é permitido usar uma transação de upsell como referência. |
400 |
Já existe um upsell para esta transação de referência. |
400 |
Tentativa de upsell rejeitada pelo antifraude (página inválida, inacessível ou suspeita; o campo reason detalha o motivo). |
400 |
Não foi possível reutilizar o cartão (token de cartão não encontrado na venda original). |
403 |
Acesso restrito (conta bloqueada ou restrição de fraude). |