通过 PIX 密钥和标识符查询交易
GET /api/pix/transactions/pix-key/{pixKey}/{identifier}
GET https://api.avista.global/api/pix/transactions/pix-key/{pixKey}/{identifier}需要在 Authorization 头中提供 Bearer token。请参阅 生成令牌 获取。
返回与 PIX 密钥关联的特定交易,通过提供的标识符进行搜索。
标识符解析逻辑:提供的值会同时与 endToEndId(PIX e2eId)、externalId 和数字 id 进行比较。实际上不存在歧义:每种类型都有唯一的格式(e2eId 以 E 开头 + 32 个字母数字字符;id 是纯数字;externalId 是其他任意字符串)。
认证
需要在 Authorization 头中提供 Bearer 令牌。
路径参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
pixKey | string | 是 | PIX 密钥(CPF、CNPJ、手机号、邮箱或随机 EVP 密钥) |
identifier | string | 是 | 交易标识符:与 endToEndId、externalId 或数字 id 进行比较 |
代码示例
curl -X GET "https://api.avista.global/api/pix/transactions/pix-key/12345678901/ext-123456" \
-H "Authorization: Bearer $AVISTA_TOKEN"const axios = require('axios');
const response = await axios.get('https://api.avista.global/api/pix/transactions/pix-key/12345678901/ext-123456', {
headers: { 'Authorization': `Bearer ${process.env.AVISTA_TOKEN}` },
});
console.log(response.data);import os, requests
response = requests.get(
'https://api.avista.global/api/pix/transactions/pix-key/12345678901/ext-123456',
headers={'Authorization': f'Bearer {os.environ["AVISTA_TOKEN"]}'},
)
print(response.json())$ch = curl_init('https://api.avista.global/api/pix/transactions/pix-key/12345678901/ext-123456');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('AVISTA_TOKEN'),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.avista.global/api/pix/transactions/pix-key/12345678901/ext-123456"))
.header("Authorization", "Bearer " + System.getenv("AVISTA_TOKEN"))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());响应 (200)
{
"transactionId": "12345",
"externalId": "ext-123456",
"status": "Confirmado",
"operationType": "Pix in",
"movementType": "CREDIT",
"originalAmount": 100.00,
"feeAmount": 1.00,
"finalAmount": 99.00,
"endToEndId": "E12345678901234567890123456789012",
"createdAt": "2025-01-15T10:30:00.000Z",
"processedAt": "2025-01-15T10:30:05.000Z",
"counterpart": {
"name": "João Silva",
"document": "***.456.789-**",
"bank": {
"bankISPB": "00000000",
"bankName": "Banco do Brasil",
"bankCode": "001",
"accountBranch": "0001",
"accountNumber": "123456-7"
}
}
}错误
| 状态码 | 描述 |
|---|---|
| 401 | 令牌缺失或无效 |
| 404 | 根据提供的 PIX 密钥和标识符未找到交易 |