Buscar Pagamento
curl --request GET \
--url https://pay.autorizou.dev/api/v1/payments/{identifier} \
--header 'Authorization: Bearer <token>'import requests
url = "https://pay.autorizou.dev/api/v1/payments/{identifier}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://pay.autorizou.dev/api/v1/payments/{identifier}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pay.autorizou.dev/api/v1/payments/{identifier}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://pay.autorizou.dev/api/v1/payments/{identifier}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://pay.autorizou.dev/api/v1/payments/{identifier}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay.autorizou.dev/api/v1/payments/{identifier}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyPagamentos
Buscar Pagamento
Consultar status e detalhes de um pagamento específico
GET
/
api
/
v1
/
payments
/
{identifier}
Buscar Pagamento
curl --request GET \
--url https://pay.autorizou.dev/api/v1/payments/{identifier} \
--header 'Authorization: Bearer <token>'import requests
url = "https://pay.autorizou.dev/api/v1/payments/{identifier}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://pay.autorizou.dev/api/v1/payments/{identifier}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pay.autorizou.dev/api/v1/payments/{identifier}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://pay.autorizou.dev/api/v1/payments/{identifier}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://pay.autorizou.dev/api/v1/payments/{identifier}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay.autorizou.dev/api/v1/payments/{identifier}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyEste endpoint permite recuperar as informações detalhadas de um pagamento específico. O
A resposta traz também
{identifier} aceita três formas: o uuid, a hash ou o seu próprio merchant_reference.
Consultar pelo
merchant_reference (a referência que você enviou ao criar a cobrança) é o caminho
mais direto para conciliar: você não precisa guardar o uuid da Autorizou do seu lado.split (como o valor foi dividido) e fees (taxa da plataforma) — veja Visibilidade pós-venda.
Casos de Uso
- Consultar status de pagamentos em tempo real
- Verificar valores e detalhes do pagamento
- Auditoria e reconciliação financeira
- Exibir dados na interface do usuário
Parâmetros de URL
string
required
Identificador do pagamento. Pode ser:
- UUID do pagamento (ex:
0026621e-ae0c-477b-998d-6442fa0645b2) - Hash do pagamento (ex:
AUTPCC01K8RSCH3T5FNB7EVACV8DQVN) - Sua referência enviada na criação como
code(merchant_reference)
Exemplo de Requisição
curl -X GET https://pay.autorizou.dev/api/v1/payments/0026621e-ae0c-477b-998d-6442fa0645b2 \
-H "Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc"
const response = await fetch('https://pay.autorizou.dev/api/v1/payments/0026621e-ae0c-477b-998d-6442fa0645b2', {
method: 'GET',
headers: {
'Authorization': 'Bearer 4eC39HqLyjWDarjtT1zdp7dc'
}
});
const payment = await response.json();
console.log('Detalhes do pagamento:', payment);
<?php
$identifier = '0026621e-ae0c-477b-998d-6442fa0645b2';
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pay.autorizou.dev/api/v1/payments/{$identifiers}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc'
]
]);
$response = curl_exec($curl);
$payment = json_decode($response, true);
curl_close($curl);
echo "Pagamento: " . json_encode($payment, JSON_PRETTY_PRINT);
?>
Resposta de Sucesso
{
"id": "abe4454e-32d3-49cd-8f79-782080a57b3c",
"hash": "AUTPCC01K8RSCH3T5FNB7EVACV8DQVN",
"merchant_reference": "ORDER-2024-001",
"status": "authorized",
"payment_method": "credit_card",
"amount": 15500,
"original_amount": 15500,
"installments": 1,
"currency": "BRL",
"description": "Compra na Loja Virtual ABC",
"notification_url": "https://seusite.com.br/webhook/autorizou",
"acquirer_reference": null,
"return_code": "00",
"refused_reason": null,
"fees": {
"fixed_fee_amount": 0,
"platform_fee_amount": 463,
"platform_fee_percentage": 2.99
},
"created_at": "2025-10-24T12:54:51.000000Z",
"updated_at": "2025-10-24T12:54:51.000000Z"
}
Campos condicionais:
split aparece quando a venda foi dividida (a divisão realizada, item a
item — veja Visibilidade pós-venda); metadata aparece apenas enquanto
o pagamento está em authentication_requested (dados do desafio 3DS). amount reflete o valor
atual (decrementado por estornos parciais); original_amount preserva o valor cobrado.Detalhes da Resposta
Dados Principais
| Campo | Tipo | Descrição |
|---|---|---|
id | string | UUID único do pagamento |
hash | string | Hash do pagamento |
merchant_reference | string | Referência do merchant |
status | string | Status atual do pagamento |
payment_method | string | Método: credit_card, pix, bank_slip, google_pay |
amount | integer | Valor em centavos |
original_amount | integer | Valor em centavos |
installments | integer | Número de parcelas |
currency | string | Moeda |
description | string | Descrição do pagamento |
notification_url | string | Url da notificação |
acquirer_reference | string | Rerefencia do adquirente |
return_code | string | Código de autorização |
metadata | array | Dados adicionais do pagamento |
Status Possíveis
| Status | Descrição | Finalizado |
|---|---|---|
authorized | Autorizado (aguarda captura) | |
authentication_requested | Autenticação solicitada | |
waiting_payment | Aguardando pagamento | |
refused | Recusado pelo banco | |
refunded | Estornado | |
error | Erro | |
processing | Sendo processado |
Códigos de Erro
404 - Not Found
404 - Not Found
Pagamento não encontradoPossíveis causas:
{
"message": "Pagamento não encontrado"
}
- UUID ou hash não existe
- Pagamento pertence a outro merchant
- UUID ou hash mal formado
400 - Bad Request
400 - Bad Request
UUID inválido
{
"message": "UUID do pagamento é inválido"
}
Casos de Uso Práticos
Verificação de Status
async function verificarStatusPagamento(paymentId) {
const payment = await fetch(`https://pay.autorizou.dev/api/v1/payments/${paymentId}`, {
headers: { 'Authorization': 'Bearer ...' }
}).then(res => res.json());
const statusMap = {
waiting_payment: { color: 'yellow', text: 'Aguardando pagamento' },
processing: { color: 'blue', text: 'Processando' },
authentication_requested: { color: 'orange', text: 'Aguardando 3DS' },
authorized: { color: 'green', text: 'Autorizado' },
refused: { color: 'red', text: 'Recusado' },
canceled: { color: 'gray', text: 'Cancelado' },
refunded: { color: 'purple', text: 'Estornado' },
refunded_partially: { color: 'purple', text: 'Estornado parcialmente' },
chargeback: { color: 'red', text: 'Chargeback' }
};
return {
id: payment.id,
status: payment.status,
display: statusMap[payment.status] || { color: 'gray', text: payment.status },
amount: payment.amount / 100,
canRefund: payment.status === 'authorized',
isFinal: ['authorized', 'refused', 'canceled', 'refunded', 'expired'].includes(payment.status)
};
}
Formatação para Display
function formatarPagamentoParaExibicao(payment) {
const paymentMethods = {
credit_card: 'Cartão de Crédito',
pix: 'PIX',
bank_slip: 'Boleto'
};
const statusIcons = {
authorized: '',
waiting_payment: '',
refused: '',
canceled: ''
};
return {
id: payment.id,
displayId: payment.id.substring(0, 8) + '...',
method: paymentMethods[payment.payment_method] || payment.payment_method,
status: `${statusIcons[payment.status] || ''} ${payment.status}`,
amount: `R$ ${(payment.amount / 100).toLocaleString('pt-BR', { minimumFractionDigits: 2 })}`,
date: new Date(payment.created_at).toLocaleDateString('pt-BR'),
reference: payment.merchant_reference
};
}
Polling de Status
async function aguardarPagamento(paymentId, timeout = 300000) { // 5 minutos
const startTime = Date.now();
const interval = 5000; // 5 segundos
return new Promise((resolve, reject) => {
const checkPayment = async () => {
try {
const payment = await buscarPagamento(paymentId);
// Status finais
if (['authorized', 'refused', 'canceled', 'expired', 'refunded'].includes(payment.status)) {
resolve(payment);
return;
}
// Timeout
if (Date.now() - startTime > timeout) {
reject(new Error('Timeout aguardando confirmação do pagamento'));
return;
}
// Continuar aguardando
setTimeout(checkPayment, interval);
} catch (error) {
reject(error);
}
};
checkPayment();
});
}
Considerações de Performance
Cache inteligente: Status finais (
authorized, refused, canceled, expired, refunded) podem ser cached por longos períodos. Lembre que um pagamento authorized ainda pode virar refunded/chargeback depois — invalide o cache ao receber webhooks.Polling eficiente: Para pagamentos em processamento, use intervalos de 5-10 segundos para verificar status.
Webhook vs Polling
Use webhooks: Prefira sempre webhooks em vez de polling para receber atualizações de status em tempo real.
// Recomendado: Webhook
app.post('/webhook/autorizou', (req, res) => {
const { event, payment } = req.body;
if (event.startsWith('payment.') && payment) {
console.log(`Pagamento ${payment.id} mudou para ${payment.status}`);
// Atualizar base de dados
updatePaymentStatus(payment.id, payment.status);
}
res.status(200).send('OK');
});
// Evitar: Polling excessivo
setInterval(() => {
checkAllPendingPayments(); // Sobrecarrega a API
}, 1000);