异步通知
在订单的整个生命周期每一次状态变化我们都会通过异步通知方式通知给notify_url,通知接收必须使用https协议,通知包括签名和支付参数(json格式)。
[!TIP|style:flat]
通知URL是提交的notify_url,支付完成后,YabandPay会相关支付和用户信息发送到该 URL,第三方受理机构需接收该通知并验签,验签通过才可做下一步操作。
对后台通知交互时,如果YabandPay收到第三方受理机构的应答不是成功或超时,YabandPay认为通知失败,YabandPay会通过一定的策略定期重新发起通知,尽可能提高通知的成功率,但YabandPay不保证通知最终能成功。
由于存在重新发送后台通知的情况,因此同样的通知可能会多次发送给合作方系统。合作方系统必须能够正确处理重复的通知。推荐的做法是,当收到通知进行处理时,首先检查对应业务数据的状态,判断该通知是否已经处理过,如果没有处理过再进行处理,如果处理过直接返回结果成功。在对业务数据进行状态检查和处理之前,要采用数据锁进行并发控制,以避免函数重入造成的数据混乱。
YabandPay将从下面IP地址返回异步通知,建议加入防火墙白名单。 8.211.41.31 8.211.10.244 8.211.8.123
1. 支付的异步通知
参数 | 类型 | 描述 |
---|---|---|
sign | String | 签名 |
type | String | payment |
user | String | 收银员账号的UID或者Email |
amount | String | 支付提交金额 |
tip_amount | String | 总金额中包含的小费 |
trade_id | String | YabandPay的交易编号 |
currency | String | 支付提交的货币种类 |
settlement_amount | String | 结算货币金额 |
settlement_currency | String | 结算货币种类 |
exchange_rate | String | 支付金额/结算金额 |
amount_cny | String | 支付人民币金额 |
settlement_rate | String | 人民币结算汇率 |
order_id | String | 商户订单号码 |
transaction_id | String | 支付方式返回的的单号,例如微信支付或者支付宝+的交易编号。大多数情况下与acquirer_id相同。 |
acquirer_id | String | 收单机构参考号,Acquirer Reference Number(ARN) |
description | String | 订单描述 |
createDate | String | 订单创建时间 |
state | String | 支付状态: Processing, Paid,Cancelled, Expired, Verify,Authorized,Declined,Failed |
demo | String | 客户自定义字段 |
out_trade_no | String | 交易系统内部订单号 |
sub_pay_method | String | 支付方式:WeChat Pay, Alipay+等(参考支付方式说明) |
pay_method | String | 支付类型:offline, online |
paid_time | String | 支付时间 |
yb_transaction_id | String | YabandPay的唯一交易ID |
3ds_status | String | 3ds状态 |
3ds_trxid | String | 3ds的唯一ID |
3ds_version | String | 3ds的版本 |
3DS返回状态:
参数 | 类型 | 描述 |
---|---|---|
A | String | Attempts Processing Performed; Not Authenticated/Verified, but a proof of attempted authentication/verification is provided. |
C | String | Challenge Required; Additional authentication is required. |
D | String | Challenge Required; Decoupled Authentication confirmed. |
I | String | Informational Only; Merchant challenge preference acknowledged. |
N | String | Not Authenticated /Account Not Verified; Transaction denied. |
R | String | Authentication/ Account Verification Rejected; Issuer is rejecting authentication/verification and requests that authorisation not be attempted. |
U | String | Authentication/Account Verification Could Not Be Performed, Technical or other problem. |
Y | String | Authentication/Account Verification Successful. |
异步通知的示例:
{
"sign": "4d1ebd43cf3a06d35282c84b990917e49d5cafc0a1cad62c2b695a1683ec6ba0",
"data": {
"type": "payment",
"user": "016683",
"order_id": "190510140815",
"trade_id": "8a8aa7c7-66d7-e2cc-e2a6-fff7c77aaefd",
"transaction_id": "4200000298201905227377147799",
"acquirer_id": "4200000298201905227377147799",
"yb_transaction_id": "c8823612-383f-35fc-f28d-c0eae039e870",
"amount": "1.00",
"tip_amount": "0.10",
"currency": "EUR",
"settlement_amount": "1.00",
"settlement_currency": "EUR",
"exchange_rate": "1",
"amount_cny": "0.77",
"settlement_rate": "7.779779",
"description": "yaband test",
"createDate": "1558510731",
"pay_method": "online",
"state": "paid",
"demo": "test",
"out_trade_no": "a4d7684a-e326-44c1-bea5-0601f7a9b191",
"sub_pay_method": "WeChat Pay",
"paid_time": "1603355159",
"3ds_status": "Y",
"3ds_trxid": "1d0c6eb3-6282-4cf9-9549-884410918d2d",
"3ds_version": "2.2.0"
}
}
2. 退款的异步通知
参数 | 类型 | 描述 |
---|---|---|
sign | String | 签名 |
type | String | refund |
user | String | 收银员账号的UID或者Email |
pay_method | String | 原支付单online或者offline |
sub_pay_method | String | 原支付单的支付方式:WeChat Pay,Alipay+等(参考支付方式说明) |
refund_id | String | 退款编号 |
m_refund_id | String | 商户在发起退款时自定义的退款单号 |
transaction_id | String | 交易编号 |
acquirer_id | String | 结算机构交易编号 |
refund_amount | String | 退款提交的金额 |
refund_currency | String | 退款货币 |
order_id | String | 商户订单号码 |
refund_description | String | 订单描述 |
refund_time | String | 退款时间 |
state | String | 退款状态:to-be-approval,refund pending, refund processing, refunded, refund error, refund failed, refund cancelled |
Notification information:
{
"sign": "b71a0b52811b98aed22b928c0ab124e39b722bca0547b5e6c5d19763bec456ae",
"data": {
"type": "refund",
"user": "016683",
"refund_id": "b20d3668-d71f-432f-8809-f84f0d9139d4",
"m_refund_id":"20240301143029616187",
"transaction_id":"cf483d9e-637c-a92d-0716-5b8199d10f8c",
"refund_amount": "1.00",
"refund_currency": "EUR",
"order_id": "200219",
"refund_description": "test",
"refund_time": "0",
"state": "refunded",
"pay_method": "online",
"sub_pay_method": "WeChat Pay",
}
}
[!TIP|style:flat]
退款提交后我们返回状态
refund processing
。在完成退款后我们会通知状态
refunded
。
3. 异步通知频率
请注意:消息通知的响应需返回status-code 200,并且body返回“ok”,如果未返回“ok”,我们将会再次发送通知。
通知频率如下:
通知次数 | 间隔时间 |
---|---|
1 | 10s |
2 | 30s |
3 | 60s |
4 | 300s |
5 | 3600s |
... | 3600s |
15 | 3600s |
如果未收到正确的ok返回,我们在通知15次后将不会再通知。
4. 异步通知支付状态说明
1. 支付状态:
代码 | 字段 | 说明 |
---|---|---|
00 | paid | 支付成功 |
01 | authorized | 授权成功 |
02 | pending | 支付被创建 |
03 | processing | 等待支付 |
04 | verify | 客户已经支付,由于风控原因正在审核中。 |
05 | declined | 支付被拒绝 |
06 | failed | 支付失败 |
07 | expired | 支付超时 |
08 | cancelled | 取消支付 |
2. 退款状态:
代码 | 字段 | 说明 |
---|---|---|
20 | to-be-approval | 等待管理员批准。 |
21 | refund pending | 当前余额不足,余额充足时自动提交退款。 |
22 | refund processing | 退款请求已经提交,系统正在处理中。 |
23 | refunded | 退款已经成功完成。 |
24 | refund failed | 退款失败,请再次尝试。 |
25 | refund error | 退款失败,请联系我们在线客服。 |
26 | refund cancelled | 退款订单已经被取消。 |