文档中心/API 接口

API REFERENCE

异步通知

在订单的整个生命周期每一次状态变化我们都会通过异步通知方式通知给notify_url,通知接收必须使用https协议,通知包括签名和支付参数(json格式)。

  1. 通知URL是提交的notify_url,支付完成后,YabandPay会相关支付和用户信息发送到该 URL,第三方受理机构需接收该通知并验签,验签通过才可做下一步操作。
  2. 对后台通知交互时,如果YabandPay收到第三方受理机构的应答不是成功或超时,YabandPay认为通知失败,YabandPay会通过一定的策略定期重新发起通知,尽可能提高通知的成功率,但YabandPay不保证通知最终能成功。
  3. 由于存在重新发送后台通知的情况,因此同样的通知可能会多次发送给合作方系统。合作方系统必须能够正确处理重复的通知。推荐的做法是,当收到通知进行处理时,首先检查对应业务数据的状态,判断该通知是否已经处理过,如果没有处理过再进行处理,如果处理过直接返回结果成功。在对业务数据进行状态检查和处理之前,要采用数据锁进行并发控制,以避免函数重入造成的数据混乱。
  4. YabandPay将从下面IP地址返回异步通知,建议加入防火墙白名单。8.211.41.31,8.211.10.244, 8.211.8.123

1. 支付的异步通知

参数类型描述
signString签名
typeStringpayment
userString收银员账号的UID或者Email
amountString支付提交金额
tip_amountString总金额中包含的小费
trade_idStringYabandPay的交易编号
currencyString支付提交的货币种类
settlement_amountString结算货币金额
settlement_currencyString结算货币种类
exchange_rateString支付金额/结算金额
amount_cnyString支付人民币金额
settlement_rateString人民币结算汇率
order_idString商户订单号码
transaction_idString支付方式返回的的单号,例如微信支付或者支付宝+的交易编号。大多数情况下与acquirer_id相同。
acquirer_idString收单机构参考号,Acquirer Reference Number(ARN)
descriptionString订单描述
createDateString订单创建时间
stateString支付状态: Processing, Paid,Cancelled, Expired, Verify,Authorized,Declined,Failed
demoString客户自定义字段
out_trade_noString交易系统内部订单号
sub_pay_methodString支付方式:WeChat Pay, Alipay+等(参考支付方式说明)
pay_methodString支付类型:offline, online
paid_timeString支付时间
yb_transaction_idStringYabandPay的唯一交易ID
3ds_statusString3ds状态
3ds_trxidString3ds的唯一ID
3ds_versionString3ds的版本
3DS返回状态:
参数类型描述
AStringAttempts Processing Performed; Not Authenticated/Verified, but a proof of attempted authentication/verification is provided.
CStringChallenge Required; Additional authentication is required.
DStringChallenge Required; Decoupled Authentication confirmed.
IStringInformational Only; Merchant challenge preference acknowledged.
NStringNot Authenticated /Account Not Verified; Transaction denied.
RStringAuthentication/ Account Verification Rejected; Issuer is rejecting authentication/verification and requests that authorisation not be attempted.
UStringAuthentication/Account Verification Could Not Be Performed, Technical or other problem.
YStringAuthentication/Account Verification Successful.
异步通知的示例:
{
	"sign": "YOUR_SIGNATURE",
	"data": {
		"type": "payment",
		"user": "YOUR_CASHIER_UID",
		"order_id": "YOUR_ORDER_ID",
		"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. 退款的异步通知

参数类型描述
signString签名
typeStringrefund
userString收银员账号的UID或者Email
pay_methodString原支付单online或者offline
sub_pay_methodString原支付单的支付方式:WeChat Pay,Alipay+等(参考支付方式说明)
refund_idString退款编号
m_refund_idString商户在发起退款时自定义的退款单号
transaction_idString交易编号
acquirer_idString结算机构交易编号
refund_amountString退款提交的金额
refund_currencyString退款货币
order_idString商户订单号码
refund_descriptionString订单描述
refund_timeString退款时间
stateString退款状态:to-be-approval,refund pending, refund processing, refunded, refund error, refund failed, refund cancelled
Notification information:
{
	"sign": "YOUR_SIGNATURE",
	"data":  {
		"type": "refund",
		"user": "YOUR_CASHIER_UID",
		"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": "YOUR_ORDER_ID",
		"refund_description": "test",
		"refund_time": "0",
		"state": "refunded",
		"pay_method": "online",
		"sub_pay_method": "WeChat Pay"}
}   

小贴士

  1. 退款提交后我们返回状态refund processing。
  1. 在完成退款后我们会通知状态refunded。

3. 异步通知频率

请注意:消息通知的响应需返回status-code 200,并且body返回“ok”,如果未返回“ok”,我们将会再次发送通知。

通知频率如下:

通知次数间隔时间
110s
230s
360s
4300s
53600s
...3600s
153600s

如果未收到正确的ok返回,我们在通知15次后将不会再通知。

4. 异步通知支付状态说明

1. 支付状态:
代码字段说明
00paid支付成功
01authorized授权成功
02pending支付被创建
03processing等待支付
04verify客户已经支付,由于风控原因正在审核中。
05declined支付被拒绝
06failed支付失败
07expired支付超时
08cancelled取消支付
2. 退款状态:
代码字段说明
20to-be-approval等待管理员批准。
21refund pending当前余额不足,余额充足时自动提交退款。
22refund processing退款请求已经提交,系统正在处理中。
23refunded退款已经成功完成。
24refund failed退款失败,请再次尝试。
25refund error退款失败,请联系我们在线客服。
26refund cancelled退款订单已经被取消。