跳到主要内容

Webhooks

注意!

QI Tech 的 webhooks 不应以严格方式进行映射。 返回的 API webhooks payload 中可能会包含额外字段。

Webhook 重发

您可以按照文档中的详细说明查询和重发 webhooks:重发 Webhooks

支付 Webhook

Webhook 请求体

Request Body: 支付已执行
{
"webhook_type": "baas.bill_payment.payment",
"webhook_datetime": "2021-10-22T20:30:23.459Z",
"data": {
"source_account_key": "ca2c934e-5970-4c15-bdef-87e1b5c204e3",
"payment_key": "8cb70dea-9fb0-4a68-9572-99a72849c8d6",
"request_control_key": "b6804f32-101e-4702-8fbc-c2dbc4c2caec",
"payment_schedule_key": null,
"transaction_key": "5f67e4fc-d3bd-4831-a9b1-20859dcee7a9",
"barcode":"00193967000009910000000003615574000000002417",
"digitable_line":"00190000090361557400500000024174396700000991000",
"payment_status": "executed",
"payment_type":"bank_slip",
"error_code": null,
"error_message": null
}
}
Request Body: 支付待执行
{
"webhook_type": "baas.bill_payment.payment",
"webhook_datetime": "2021-10-22T20:30:23.459Z",
"data": {
"source_account_key": "ca2c934e-5970-4c15-bdef-87e1b5c204e3",
"payment_key": "8cb70dea-9fb0-4a68-9572-99a72849c8d6",
"request_control_key": "b6804f32-101e-4702-8fbc-c2dbc4c2caec",
"payment_schedule_key": null,
"transaction_key": "5f67e4fc-d3bd-4831-a9b1-20859dcee7a9",
"barcode":"00193967000009910000000003615574000000002417",
"digitable_line":"00190000090361557400500000024174396700000991000",
"payment_status": "pending_execution",
"payment_type":"bank_slip",
"error_code": null,
"error_message": null
}
}
Request Body: 支付已拒绝
{
"webhook_type": "baas.bill_payment.payment",
"webhook_datetime": "2021-10-22T20:30:23.459Z",
"data": {
"source_account_key": "ca2c934e-5970-4c15-bdef-87e1b5c204e3",
"payment_key": "8cb70dea-9fb0-4a68-9572-99a72849c8d6",
"request_control_key": "b6804f32-101e-4702-8fbc-c2dbc4c2caec",
"payment_schedule_key": null,
"transaction_key": null,
"barcode":"00193967000009910000000003615574000000002417",
"digitable_line":"00190000090361557400500000024174396700000991000",
"payment_status": "rejected",
"payment_type":"bank_slip",
"error_code": "BIP000023",
"error_message": "The source account has insufficient balance. Payment cannot be made."
}
}
Request Body: 支付已冲销
{
"webhook_type": "baas.bill_payment.payment",
"webhook_datetime": "2021-10-22T20:30:23.459Z",
"data": {
"source_account_key": "ca2c934e-5970-4c15-bdef-87e1b5c204e3",
"payment_key": "8cb70dea-9fb0-4a68-9572-99a72849c8d6",
"request_control_key": "b6804f32-101e-4702-8fbc-c2dbc4c2caec",
"payment_schedule_key": null,
"transaction_key": "5f67e4fc-d3bd-4831-a9b1-20859dcee7a9",
"barcode":"00193967000009910000000003615574000000002417",
"digitable_line":"00190000090361557400500000024174396700000991000",
"payment_status": "reverted",
"payment_type":"bank_slip",
"error_code": "BIP000029",
"error_message": "Bank slip payment write off rejected."
}
}

Webhook Body 参数

字段类型描述
webhook_typestring定义所报告事件类型的枚举值
webhook_datetimestringwebhook 发送的日期和时间
request_control_keyuuid4客户请求唯一标识键。
source_account_key *uuid4被扣款账户的键。
payment_keyuuid4支付唯一标识键。
payment_schedule_keyuuid4预约唯一标识键(仅适用于由预约生成的支付)。
barcodestring条形码。
digitable_linestring数字行。
payment_typeenum支付类型。
payment_statusenum支付状态。
error_codestring错误代码。
error_messagestring错误信息。

payment_type 枚举值

枚举值类型描述
bank_slipstring银行票据
collection_slipstring征税发票

payment_status 枚举值

枚举值类型描述
executedstring已执行
rejectedstring已拒绝
revertedstring已冲销
HTTP 代码QI 代码标题描述(英文)描述(葡文)
400BIP000013Bad RequestThe source account is closed.A conta de origem está fechada.
400BIP000014Bad RequestThe source account is blocked.A conta de origem está bloqueada.
400BIP000023Bad RequestThe source account has insufficient balance. Payment cannot be made.A conta de origem possui saldo insuficiente. Pagamento não pode ser realizado.
400BIP000025Bad RequestIt was not possible to pay the bank slip at this time. Please verify your information and, if necessary, contact us for assistance.Não foi possível pagar o boleto neste momento. Por favor, verifique suas informações e, se necessário, entre em contato conosco para assistência.
400BIP000029Bad RequestBank slip payment write off rejected.Baixa de pagamento de boleto rejeitada.
400BIP000034Bad RequestCollection slip already paid.Fatura de recolhimento já paga.
400BIP000036Bad RequestCovenant slip overdue.Fatura de recolhimento vencida.
400BIP000038Bad RequestOutside of covenant payment hours.Fora do horário de pagamento do convênio.

支付预约 Webhook

支付预约的 Webhook 流程

预约和执行支付的过程涉及使用不同的 webhooks,每个 webhook 在通知和跟踪支付状态方面都有其特定作用。

当预约在请求的日期执行时,可能进入 executed 状态,届时将触发状态为 executedpayment_schedule webhook,预约执行会创建状态为 pendingpayment 并发送相应 webhook。或者,在账户关闭或票据金额变更等情况下,预约可能进入 rejected 状态,而不会创建 payment。在这种情况下,仅发送状态为 rejectedpayment_schedule webhook,并附带相应错误代码。

  • 最初,支付状态为 pending,因为支付过程正在进行中。支付完成后,将发送新的 payment webhook,此时状态为 executed
  • 如果支付无法完成(例如因账户余额不足),将发送状态为 rejectedpayment webhook,并附带相应错误代码。
  • 在账户余额不足的情况下,系统将进行最多 3 次支付尝试,每次间隔 30 分钟。在这种情况下,同一个已执行预约可能会生成多条支付记录。例如,如果仅在第三次尝试时才有足够余额,则前两次支付的 webhooks 将以 paymentrejected 状态触发,第三次支付的 webhooks 则以 paymentexecuted 状态触发。

Webhook 请求体

Request Body: 支付预约已执行
{
"webhook_type": "baas.bill_payment.payment_schedule",
"webhook_datetime": "2021-10-22T20:30:23.459Z",
"data": {
"source_account_key": "ca2c934e-5970-4c15-bdef-87e1b5c204e3",
"payment_schedule_key": "a72947e5-e676-4710-8f66-7d345f1c4064",
"payment_key": "8cb70dea-9fb0-4a68-9572-99a72849c8d6",
"request_control_key": "b6804f32-101e-4702-8fbc-c2dbc4c2caec",
"barcode":"00193967000009910000000003615574000000002417",
"digitable_line":"00190000090361557400500000024174396700000991000",
"payment_type":"bank_slip",
"payment_schedule_status": "executed",
"error_code": null,
"error_message": null
}
}
Request Body: 支付预约已拒绝
{
"webhook_type": "baas.bill_payment.payment_schedule",
"webhook_datetime": "2021-10-22T20:30:23.459Z",
"data": {
"source_account_key": "ca2c934e-5970-4c15-bdef-87e1b5c204e3",
"payment_schedule_key": "a72947e5-e676-4710-8f66-7d345f1c4064",
"payment_key": "8cb70dea-9fb0-4a68-9572-99a72849c8d6",
"request_control_key": "b6804f32-101e-4702-8fbc-c2dbc4c2caec",
"barcode":"00193967000009910000000003615574000000002417",
"digitable_line":"00190000090361557400500000024174396700000991000",
"payment_type":"bank_slip",
"payment_schedule_status": "rejected",
"error_code": "BIP000007",
"error_message": "Bank slip blocked for payment"
}
}

Webhook Body 参数

字段类型描述
webhook_typestring定义所报告事件类型的枚举值
webhook_datetimestringwebhook 发送的日期和时间
request_control_keyuuid4客户请求唯一标识键。
source_account_key *uuid4被扣款账户的键。
payment_keyuuid4支付唯一标识键。
payment_schedule_keyuuid4支付预约唯一标识键。
barcodestring条形码。
digitable_linestring数字行。
payment_typeenum支付预约类型。
payment_schedule_statusenum支付预约状态。
error_codestring错误代码。
error_messagestring错误信息。

payment_type 枚举值

枚举值类型描述
bank_slipstring银行票据
collection_slipstring征税发票

payment_schedule_status 枚举值

枚举值类型描述
executedstring已执行
rejectedstring已拒绝
HTTP 代码QI 代码标题描述(英文)描述(葡文)
400BIP000013Bad RequestThe source account is closed.A conta de origem está fechada.
400BIP000014Bad RequestThe source account is blocked.A conta de origem está bloqueada.
400BIP000006Bad RequestBank slip already written offBoleto já baixado
400BIP000007Bad RequestBank slip blocked for paymentBoleto bloqueado para pagamento
400BIP000008Bad RequestBank slip already paidBoleto já pago
400BIP000009Bad RequestInvalid bank slip. Please consult issuing bankBoleto inválido. Favor consultar banco emissor
400BIP000034Bad RequestCollection slip already paid.Fatura de recolhimento já paga.