Skip to content

代付订单回调 ​

简述 ​

  • Payout 结果异步回调通知

回调通知规则 ​

  1. 无论创建代付订单时是否传入 serverNotifyUrl,均须在商户后台配置并开启对应回调事件(payout.success、payout.fail);通知地址优先使用请求传入的 serverNotifyUrl,未传入时使用商户后台配置的回调通知 URL。
  2. 回调请求超时时间为 5 秒,需返回 HTTP 200 才视为接收成功;若未正常响应,平台将按重试策略多次推送(总计最多推送 5 次,含首次推送)。

回调 URL ​

  • 创建代付订单传入的 serverNotifyUrl 或商户后台配置的回调地址(POST application/json)

推送 Header 参数 ​

参数名类型说明
merchantKeyIdString商户 keyId
versionString接口版本号,固定值:1.0
timeStampString当前时间戳(秒级 Unix 时间戳)
signatureString使用平台 RSA 私钥对 data 解密后明文 JSON 字符串的签名串

推送 Body 参数 ​

  • body
参数名类型说明
callbackNoString回调序号(UUID)
merchantIdString商户编码
outOrderCodeString商户订单号
callBackBusiString回调业务类型,固定值:online_payout
callBackEventString回调事件:payout.success / payout.fail
codeInt响应码
messageString响应码说明
dataString业务数据经 AES-256-CBC 加密后的 Base64 密文

解密与验签

商户收到回调后,先使用 AES 密钥对 data 字段解密得到明文 JSON 字符串,再使用平台公钥对解密后的明文 JSON 字符串和 Header 中的 signature 进行验签。

  • data 解密后明文字段
参数名类型说明
merchantIdString商户编码
orderIdString平台订单号
paymentOrderIdString平台付款流水号,人工付款该字段为空
merOrderIdString商户订单号
subMerIdString二级商户编号
orderTypeString交易类型
paymentTypeString付款方式:
stcpay:STCPay 付款
cardpay:卡付款
orderPaymentTypeString付款订单类型:
standard:标准付款
rapid:快捷付款
orderStatusInt代付订单状态:
0:未付款
2:付款中
10:付款成功
20:付款失败
orderStatusDescString代付订单状态描述
remarksString付款备注
paymentCreateTimeString订单创建时间
paymentCompleteTimeString订单付款完成时间
amountInfoObject金额信息,对象格式(Object:amountInfo)
feeInfoObject费用信息,对象格式(Object:feeInfo)
accountInfoObject付款账户信息,对象格式(Object:accountInfo)
customerInfoObject客户信息,对象格式(Object:customerInfo)
  • Object:amountInfo
参数名类型说明
orderCurrencyString交易币种
orderAmtString付款金额
exchangeRateString换汇汇率
paymentCurrencyString换汇付款币种
paymentOrderAmtString换汇付款金额
paymentAmtString实际付款金额
  • Object:feeInfo
参数名类型说明
feeTypeInt手续费承担方式:
0:客户承担
1:商户承担
feeCurrencyString手续费币种
feeAmtString手续费金额
deductionCurrencyString平台账户扣款币种
deductionAmtString平台账户扣款金额
  • Object:accountInfo
参数名类型说明
typeInt账户类型:
0:未知
1:银行账户
2:STCPay 账户
accountString账户:STCPay 账户或银行卡号
bankCodeString平台银行编码,STCPay 付款时为空
ibanString客户 IBAN,STCPay 付款时为空
swiftCodeString客户银行 Swift Code,STCPay 付款时为空
bankAddressString客户银行地址,STCPay 付款时为空
  • Object:customerInfo
参数名类型说明
merCustomerIdString商户系统中客户 ID
enFirstNameString客户英文名称-前
enMiddleNameString客户英文名称-中
enLastNameString客户英文名称-后
arFirstNameString客户阿拉伯文名称-前
arMiddleNameString客户阿拉伯文名称-中
arLastNameString客户阿拉伯文名称-后
idNumberString客户身份证号
idPhotoString客户身份证照片 URL
signedPhotoString客户签名照片 URL
mobileString客户沙特手机号
emailString客户邮箱地址
addressString客户地址

推送示例(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 视作接收成功。