PayZuPayZu Docs

Webhooks

每当状态变化时,API 都会向创建充值或提现时提供的 callbackUrl 发送 POST 请求。请求体为 JSON,包含更新后的交易数据。

什么是 webhook(callback)

无需让您的系统不断询问"已支付了吗?",当事件发生时,PayZu 会主动调用您

如何配置

在每次创建请求中传入 callbackUrl(POST /pixPOST /withdraw 等):

{
  "amount": 99.90,
  "callbackUrl": "https://seusite.com.br/webhooks/payzu",
  "clientReference": "order-2025-001"
}

该 endpoint 必须可公网访问,并在 5 秒内返回 HTTP 2xx,接受:

Content-Type: application/json

重试机制

当未在 5 秒内收到 2xx 响应时,PayZu 会以指数退避加抖动的方式重新发送 callback,最多 72 次

发送的字段

标识信息

字段类型说明
idstringPayZu 中交易的唯一标识符
clientReferencestring您提供的外部标识符
typestringDEPOSITWITHDRAW
statusstring参见交易状态
amountnumber金额,单位雷亚尔(BRL)
serviceFeeChargednumber已收取的手续费

生成的收款单

字段类型说明
qrCodeTextstringPix 复制粘贴码(EMV)
qrCodeBase64stringQR Code 图像的 Base64 编码
qrCodeUrlstringQR Code 的 PNG 公开 URL
generatedNamestring关联名称
generatedDocumentstringCPF 或 CNPJ
generatedEmailstring关联邮箱

付款方

字段类型说明
payerNamestring付款人姓名(如果有)
payerDocumentstring付款人证件号
payerInstitutionIspbstring付款人所属机构的 ISPB
payerInstitutionNamestring机构名称

收款方

字段类型说明
receiverNamestring收款人姓名(如果提供)
receiverDocumentstring收款人证件号
receiverInstitutionIspbstring收款人所属机构的 ISPB
receiverInstitutionNamestring机构名称

通过密钥提现

字段类型说明
withdrawPixKeystring提现使用的 Pix 密钥
withdrawPixTypestring参见密钥类型

时间戳与争议

字段类型说明
createdAtstring交易创建时间(ISO 8601)
updatedAtstring最近更新时间
paidAtstring | null支付时间(若尚未支付则为 null)
endToEndIdstringPix 的 EndToEnd ID
infractionobject | undefined仅在发生 MED 争议时出现,参见术语表

最佳实践

  • 快速响应:在 5 秒内返回 2xx。耗时处理放入队列异步执行
  • idempotência:存储 id + status 用于去重
  • 使用 clientReference:在创建时传入外部标识符
  • 按 IP 限制:仅接受来自 PayZu 官方 IP 的 callback

支持

On this page