Obter pagamento
Recupere um pagamento específico pelo ID do Pix.
Busca um pagamento usando o ID do Pix.
GET /payments/:pix_id
Requer autenticação. Envie suas credenciais no header Authorization. Veja Autenticação.
Requisição
GET /payments/{pix_id}
Authorization: Basic <suas_credenciais_em_base64>Parâmetros
Prop
Type
Resposta
{
"pix_id": "ba5ce1d5cd58ff77d99b36cee2224e37",
"external_id": "6b912619-f8b5-46f9-b16a-872743f5ed50",
"pix_code": "00020126360014BR.GOV.BCB.PIX0114...",
"qrcode_image": "<base64>",
"value": "9.99",
"receivable_value": "9.50",
"paggpix_fee_percentage": "0.50",
"paggpix_fee_value": "0.50",
"partner_fee_percentage": "0.25",
"partner_fee_value": "0.25",
"customer": {},
"created": "2024-01-01T00:00:00.000Z",
"expires": "2024-01-02T00:00:00.000Z"
}O corpo segue a estrutura de PaymentResponse (ver Criar pagamento).
Este endpoint não retorna o campo status. Para consultar o status atual do pagamento, use Verificar pagamento.
Códigos de status
| Status | Descrição |
|---|---|
| 200 | Pagamento encontrado |
| 404 | Pagamento não encontrado |
Exemplos
curl https://public-api.paggpix.com/payments/{pix_id} \
-H "Authorization: Basic <suas_credenciais_em_base64>"const axios = require('axios');
const CLIENT_ID = '<seu_client_id>';
const CLIENT_SECRET = '<seu_client_secret>';
const CREDENTIALS = Buffer.from(`${CLIENT_ID}:${CLIENT_SECRET}`).toString('base64');
const BASE_URL = 'https://public-api.paggpix.com';
async function getPayment(pixId) {
try {
const { data } = await axios.get(`${BASE_URL}/payments/${pixId}`, {
headers: { Authorization: `Basic ${CREDENTIALS}` },
});
console.log(`Payment details: id = ${data.pix_id}, value = ${data.value}, created = ${data.created}`);
} catch (error) {
console.error(error.response ? error.response.data : error.message);
}
}