NTX Paydocs

配置账户 webhook

POST /api/webhooks

为特定事件类型配置或更新 webhook URL。如果同一事件类型已存在 webhook,将进行更新(upsert 行为)。

认证

需要在 Authorization 头中提供 Bearer 令牌。

可用事件

事件描述
cash_in收到 PIX 付款
cash_out发送 PIX 付款
refund_in已收付款的退款(发起退款请求)
refund_out收到退款

请求体

字段类型必填描述
urlstring接收 webhooks 的端点 HTTPS URL
eventTypestring事件类型:cash_incash_outrefund_inrefund_out
headersarray用于身份验证的自定义请求头(最多 5 个)。禁用的请求头:hostcontent-lengthconnectiontransfer-encodingcontent-typeuser-agent
headers[].keystring请求头名称
headers[].valuestring请求头值
{
  "url": "https://api.example.com/webhooks/pix",
  "eventType": "cash_in",
  "headers": [
    { "key": "Authorization", "value": "Bearer token123" },
    { "key": "X-Webhook-Secret", "value": "abc123" }
  ]
}

响应 (200)

字段类型描述
successboolean表示操作是否成功
messagestring结果描述信息
{
  "success": true,
  "message": "Webhook configurado com sucesso"
}

错误

状态码描述
400数据无效(URL 非 HTTPS、事件类型无效等)
401令牌缺失或无效
404账户未找到
500配置 webhook 时内部错误

本页目录