重新发送交易 webhook
POST /api/resend-webhook/{transactionIdentifier}
POST https://api.avista.global/api/resend-webhook/{transactionIdentifier}需要在 Authorization 头中提供 Bearer token。请参阅 生成令牌 获取。
将特定交易的 webhook 重新发送到已配置的 URL 或临时 URL(覆盖)。
交易标识符可以是:
- 数字交易 ID:Avista 返回的 ID(webhooks 中的
transactionId字段) - 您的引用 ID:创建交易时提供的标识符(
externalId) - PIX End-to-End ID:webhooks 中返回的
e2eId(格式:E/D + 32 个字符)
认证
需要在 Authorization 头中提供 Bearer 令牌。
路径参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
transactionIdentifier | string | 是 | 交易标识符:数字 id、externalId 或 endToEndId |
请求体(可选)
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
url | string | 否 | 此次重新发送的临时 URL。如果未提供,将使用账户 webhook 中配置的 URL。该 URL 不会被持久化 |
{
"url": "https://meu-servidor.com/webhooks/avista"
}URL 行为
- 如果请求体中提供了
url,则临时使用该 URL(不会持久化) - 如果未提供
url,则使用账户 webhook 中为该操作类型配置的 URL - 如果没有可用的 URL,返回错误 400
代码示例
curl -X POST "https://api.avista.global/api/resend-webhook/PAG-2024-0001" \
-H "Authorization: Bearer $AVISTA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://meu-servidor.com/webhooks/avista"
}'const axios = require('axios');
const response = await axios.post('https://api.avista.global/api/resend-webhook/PAG-2024-0001',
{
"url": "https://meu-servidor.com/webhooks/avista"
},
{
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/resend-webhook/PAG-2024-0001',
headers={
'Authorization': f'Bearer {os.environ["AVISTA_TOKEN"]}',
'Content-Type': 'application/json',
},
json={
"url": "https://meu-servidor.com/webhooks/avista"
},
)
print(response.json())$ch = curl_init('https://api.avista.global/api/resend-webhook/PAG-2024-0001');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('AVISTA_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{
"url": "https://meu-servidor.com/webhooks/avista"
}',
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;String body = """
{
"url": "https://meu-servidor.com/webhooks/avista"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.avista.global/api/resend-webhook/PAG-2024-0001"))
.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());响应 (200)
| 字段 | 类型 | 描述 |
|---|---|---|
message | string | 结果描述信息 |
webhookLogId | number | 为审计生成的 webhook 日志 ID |
sentAt | string | Webhook 发送日期/时间(ISO 8601) |
statusCode | number | 目标 URL 返回的 HTTP 状态码 |
{
"message": "Webhook resent successfully",
"webhookLogId": 12345,
"sentAt": "2024-01-15T10:30:00.000Z",
"statusCode": 200
}错误
| 状态码 | 描述 |
|---|---|
| 400 | 没有可用的 webhook URL。请为此交易的操作类型配置 webhook,或在 url 字段中提供临时 URL |
| 401 | 令牌无效、已过期或缺失 |
| 404 | 交易未找到或不属于已认证的账户 |
| 429 | 超过速率限制(最大 60 请求/分钟) |