主题
代付订单回调
简述
- Payout 结果异步回调通知
回调通知规则
- 无论创建代付订单时是否传入
serverNotifyUrl,均须在商户后台配置并开启对应回调事件(payout.success、payout.fail);通知地址优先使用请求传入的serverNotifyUrl,未传入时使用商户后台配置的回调通知 URL。 - 回调请求超时时间为 5 秒,需返回 HTTP 200 才视为接收成功;若未正常响应,平台将按重试策略多次推送(总计最多推送 5 次,含首次推送)。
回调 URL
- 创建代付订单传入的
serverNotifyUrl或商户后台配置的回调地址(POSTapplication/json)
推送 Header 参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| merchantKeyId | String | 商户 keyId |
| version | String | 接口版本号,固定值:1.0 |
| timeStamp | String | 当前时间戳(秒级 Unix 时间戳) |
| signature | String | 使用平台 RSA 私钥对 data 解密后明文 JSON 字符串的签名串 |
推送 Body 参数
- body
| 参数名 | 类型 | 说明 |
|---|---|---|
| callbackNo | String | 回调序号(UUID) |
| merchantId | String | 商户编码 |
| outOrderCode | String | 商户订单号 |
| callBackBusi | String | 回调业务类型,固定值:online_payout |
| callBackEvent | String | 回调事件:payout.success / payout.fail |
| code | Int | 响应码 |
| message | String | 响应码说明 |
| data | String | 业务数据经 AES-256-CBC 加密后的 Base64 密文 |
解密与验签
商户收到回调后,先使用 AES 密钥对 data 字段解密得到明文 JSON 字符串,再使用平台公钥对解密后的明文 JSON 字符串和 Header 中的 signature 进行验签。
data解密后明文字段
| 参数名 | 类型 | 说明 |
|---|---|---|
| merchantId | String | 商户编码 |
| orderId | String | 平台订单号 |
| paymentOrderId | String | 平台付款流水号,人工付款该字段为空 |
| merOrderId | String | 商户订单号 |
| subMerId | String | 二级商户编号 |
| orderType | String | 交易类型 |
| paymentType | String | 付款方式:stcpay:STCPay 付款cardpay:卡付款 |
| orderPaymentType | String | 付款订单类型:standard:标准付款rapid:快捷付款 |
| orderStatus | Int | 代付订单状态:0:未付款2:付款中10:付款成功20:付款失败 |
| orderStatusDesc | String | 代付订单状态描述 |
| remarks | String | 付款备注 |
| paymentCreateTime | String | 订单创建时间 |
| paymentCompleteTime | String | 订单付款完成时间 |
| amountInfo | Object | 金额信息,对象格式(Object:amountInfo) |
| feeInfo | Object | 费用信息,对象格式(Object:feeInfo) |
| accountInfo | Object | 付款账户信息,对象格式(Object:accountInfo) |
| customerInfo | Object | 客户信息,对象格式(Object:customerInfo) |
Object:amountInfo
| 参数名 | 类型 | 说明 |
|---|---|---|
| orderCurrency | String | 交易币种 |
| orderAmt | String | 付款金额 |
| exchangeRate | String | 换汇汇率 |
| paymentCurrency | String | 换汇付款币种 |
| paymentOrderAmt | String | 换汇付款金额 |
| paymentAmt | String | 实际付款金额 |
Object:feeInfo
| 参数名 | 类型 | 说明 |
|---|---|---|
| feeType | Int | 手续费承担方式:0:客户承担1:商户承担 |
| feeCurrency | String | 手续费币种 |
| feeAmt | String | 手续费金额 |
| deductionCurrency | String | 平台账户扣款币种 |
| deductionAmt | String | 平台账户扣款金额 |
Object:accountInfo
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | Int | 账户类型:0:未知1:银行账户2:STCPay 账户 |
| account | String | 账户:STCPay 账户或银行卡号 |
| bankCode | String | 平台银行编码,STCPay 付款时为空 |
| iban | String | 客户 IBAN,STCPay 付款时为空 |
| swiftCode | String | 客户银行 Swift Code,STCPay 付款时为空 |
| bankAddress | String | 客户银行地址,STCPay 付款时为空 |
Object:customerInfo
| 参数名 | 类型 | 说明 |
|---|---|---|
| merCustomerId | String | 商户系统中客户 ID |
| enFirstName | String | 客户英文名称-前 |
| enMiddleName | String | 客户英文名称-中 |
| enLastName | String | 客户英文名称-后 |
| arFirstName | String | 客户阿拉伯文名称-前 |
| arMiddleName | String | 客户阿拉伯文名称-中 |
| arLastName | String | 客户阿拉伯文名称-后 |
| idNumber | String | 客户身份证号 |
| idPhoto | String | 客户身份证照片 URL |
| signedPhoto | String | 客户签名照片 URL |
| mobile | String | 客户沙特手机号 |
| String | 客户邮箱地址 | |
| address | String | 客户地址 |
推送示例(data 为 AES 密文)
json
{
"callbackNo": "550e8400-e29b-41d4-a716-446655440000",
"merchantId": "MER12345678",
"outOrderCode": "TEST1234567890",
"callBackBusi": "online_payout",
"callBackEvent": "payout.success",
"code": 10000,
"message": "success",
"data": "plavp+E0T+yZd+EN7CyIw8D3rS41Foa/36n6IAStC8MTBQ7XvbYoh+WOD7EZGC6H..."
}data 解密后明文示例
json
{
"merchantId": "MER12345678",
"orderId": "OUT250923112601207221172",
"paymentOrderId": "PYT250923113029303446556",
"merOrderId": "TEST1234567890",
"subMerId": "SME30245285",
"orderType": "online_payout",
"paymentType": "cardpay",
"orderPaymentType": "standard",
"orderStatus": 10,
"orderStatusDesc": "Payment successful",
"remarks": "Test Order",
"paymentCreateTime": "2025-09-23 11:33:08",
"paymentCompleteTime": "2025-09-23 12:33:08",
"amountInfo": {
"orderCurrency": "SAR",
"orderAmt": "100",
"exchangeRate": "1",
"paymentCurrency": "SAR",
"paymentOrderAmt": "100",
"paymentAmt": "100"
},
"feeInfo": {
"feeType": 1,
"feeCurrency": "SAR",
"feeAmt": "1",
"deductionCurrency": "SAR",
"deductionAmt": "101"
},
"accountInfo": {
"type": 1,
"account": "1234567891",
"bankCode": "SAU0004",
"iban": "SA123456789123456789",
"swiftCode": "INMASARI",
"bankAddress": "INMA BANK, KSA"
},
"customerInfo": {
"merCustomerId": "12345678",
"enFirstName": "Mohammed",
"enMiddleName": "Ali",
"enLastName": "Khaled",
"arFirstName": "محمد",
"arMiddleName": "علي",
"arLastName": "خالد",
"idNumber": "1234512345",
"idPhoto": "https://xxxx.com/images/customer/20250526/d1b55874817a4ea1961fc93bb2b793c6.jpg",
"signedPhoto": "https://xxxx.com/images/customer/20250808/d0c3a9907fa540afb9631266bd6714d5.png",
"mobile": "512345678",
"email": "demo@example.com",
"address": "Riyadh, Saudi Arabia"
}
}响应参数
- 商户收到回调后,HTTP 状态码需返回
200视作接收成功。
