通过二维码发送 PIX 付款(Cash-Out QR Code)
POST /api/pix/cash-out-qrcode
POST https://api.avista.global/api/pix/cash-out-qrcode需要在 Authorization 头中提供 Bearer token。请参阅 生成令牌 获取。
通过扫描或复制的二维码(复制粘贴)发送 PIX 付款。二维码必须符合中央银行 EMV PIX 标准。
认证
需要在 Authorization 头中提供 Bearer 令牌。
请求体
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
value | number | 是 | 付款金额(巴西雷亚尔,最多 2 位小数)。如果二维码中包含金额,必须与之匹配 |
qrCode | string | 是 | PIX 二维码内容(EMV 字符串)。最少 50 个字符,最多 500 个字符。必须以 000201 开头 |
externalId | string | 是 | 交易的唯一外部标识符 |
description | string | 否 | 可选的付款描述 |
name | string | 否 | 收款人姓名(可能包含在二维码中) |
document | string | 否 | 收款人 CPF 或 CNPJ(可能包含在二维码中) |
{
"value": 15.50,
"qrCode": "00020126580014br.gov.bcb.pix0136a1b2c3d4-e5f6-7890-abcd-ef1234567890520400005303986540515.505802BR5925DESTINATARIO LTDA6009SAO PAULO62070503***6304ABCD",
"externalId": "QRPAY-987654-20240119",
"description": "Pagamento fornecedor XYZ via QR Code",
"name": "Destinatário Ltda",
"document": "12345678000190"
}代码示例
curl -X POST "https://api.avista.global/api/pix/cash-out-qrcode" \
-H "Authorization: Bearer $AVISTA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"value": 15.50,
"qrCode": "00020126580014br.gov.bcb.pix0136a1b2c3d4-e5f6-7890-abcd-ef1234567890520400005303986540515.505802BR5925DESTINATARIO LTDA6009SAO PAULO62070503***6304ABCD",
"externalId": "QRPAY-987654-20240119",
"description": "Pagamento fornecedor XYZ via QR Code",
"name": "Destinatário Ltda",
"document": "12345678000190"
}'const axios = require('axios');
const response = await axios.post('https://api.avista.global/api/pix/cash-out-qrcode',
{
"value": 15.50,
"qrCode": "00020126580014br.gov.bcb.pix0136a1b2c3d4-e5f6-7890-abcd-ef1234567890520400005303986540515.505802BR5925DESTINATARIO LTDA6009SAO PAULO62070503***6304ABCD",
"externalId": "QRPAY-987654-20240119",
"description": "Pagamento fornecedor XYZ via QR Code",
"name": "Destinatário Ltda",
"document": "12345678000190"
},
{
headers: {
'Authorization': `Bearer ${process.env.AVISTA_TOKEN}`,
'Content-Type': 'application/json',
},
}
);
console.log(response.data);import os, requests
response = requests.post(
'https://api.avista.global/api/pix/cash-out-qrcode',
headers={
'Authorization': f'Bearer {os.environ["AVISTA_TOKEN"]}',
'Content-Type': 'application/json',
},
json={
"value": 15.50,
"qrCode": "00020126580014br.gov.bcb.pix0136a1b2c3d4-e5f6-7890-abcd-ef1234567890520400005303986540515.505802BR5925DESTINATARIO LTDA6009SAO PAULO62070503***6304ABCD",
"externalId": "QRPAY-987654-20240119",
"description": "Pagamento fornecedor XYZ via QR Code",
"name": "Destinatário Ltda",
"document": "12345678000190"
},
)
print(response.json())$ch = curl_init('https://api.avista.global/api/pix/cash-out-qrcode');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('AVISTA_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{
"value": 15.50,
"qrCode": "00020126580014br.gov.bcb.pix0136a1b2c3d4-e5f6-7890-abcd-ef1234567890520400005303986540515.505802BR5925DESTINATARIO LTDA6009SAO PAULO62070503***6304ABCD",
"externalId": "QRPAY-987654-20240119",
"description": "Pagamento fornecedor XYZ via QR Code",
"name": "Destinatário Ltda",
"document": "12345678000190"
}',
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;String body = """
{
"value": 15.50,
"qrCode": "00020126580014br.gov.bcb.pix0136a1b2c3d4-e5f6-7890-abcd-ef1234567890520400005303986540515.505802BR5925DESTINATARIO LTDA6009SAO PAULO62070503***6304ABCD",
"externalId": "QRPAY-987654-20240119",
"description": "Pagamento fornecedor XYZ via QR Code",
"name": "Destinatário Ltda",
"document": "12345678000190"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.avista.global/api/pix/cash-out-qrcode"))
.header("Authorization", "Bearer " + System.getenv("AVISTA_TOKEN"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());响应 (201)
| 字段 | 类型 | 描述 |
|---|---|---|
transactionId | string | 生成的交易内部标识符 |
externalId | string | 请求中提供的外部标识符 |
status | string | 当前交易状态(PENDING、CONFIRMED、ERROR) |
generateTime | string | 交易生成日期/时间(ISO 8601) |
{
"transactionId": "456",
"externalId": "QRPAY-987654-20240119",
"status": "PENDING",
"generateTime": "2024-01-19T14:30:00.000Z"
}错误
| 状态码 | 描述 |
|---|---|
| 400 | 数据无效、二维码无效、金额不匹配或余额不足 |
| 401 | 令牌缺失或无效 |
| 409 | externalId 已在其他交易中使用 |
| 500 | 通过二维码处理 PIX 付款时出错 |