JSAPI调起支付分订单详情页
更新时间:2024.12.05||
商户使用微信支付提供的JS调起微信支付分小程序,引导用户查看订单(公众号端)
接口说明
字段说明
请求参数
businessType 必填 string(16)
固定配置:wxpayScoreDetail。
queryString 必填 string(2048)
使用URL的query string方式传递参数,格式为key=value&key2=value2,其中value,value2需要进行UrlEncode处理。
 | 属性 |
| mch_id 必填 string(32) 【服务商商户号】调用支付分创单接口提交的商户号,商户号需开通支付分产品权限,且与appid有绑定关系,详见服务商商户号与AppID账号关联管理。
service_id 必填 string(32) 【服务ID】商户支付分服务的唯一标识,由32位数字组成。支付分产品权限审核通过后,微信支付运营会向商户提供该ID。
out_order_no 必填 string(32) 【商户服务订单号】 商户系统内部服务订单号,要求32个字符内,只能是数字、大小写字母_-|* 且在同一个商户号下唯一。需要开发者特别注意,该参数不可用于申请退款接口中的 out_trade_no 参数。
timestamp 必填 string(32) 【时间戳】标准北京时间,时区为东八区,自1970年1月1日 0点0分0秒以来的秒数。注意:部分系统取到的值为毫秒级,需要转换成秒(10位数字)。
nonce_str 必填 string(32) 【随机串】生成签名随机串。由数字、大小写字母组成,长度不超过32位。
sign_type 必填 string(32) 【签名类型】仅支持HMAC-SHA256。
sign 必填 string(64) 【签名值】使用字段mch_id、service_id、out_order_no、timestamp、nonce_str、sign_type按照签名生成算法计算得出的签名值。 注意:该接口签名需使用APIv2密钥 |
请求示例

1let wechatInfo = navigator.userAgent.match(/MicroMessenger\/([\d\.]+)/i);
2let wechatVersion = wechatInfo[1];
3
4if (compareVersion(wechatVersion, '7.0.5') >= 0) {
5 goToWXScore();
6} else {
7
8 window.href = 'https://support.weixin.qq.com/cgi-bin/readtemplate?t=page/common_page__upgrade&
9 text=text005&btn_text=btn_text_0'
10}
11
12
13
14
15function goToWXScore() {
16 wx.checkJsApi({
17 jsApiList: ['openBusinessView'],
18 success: function (res) {
19
20
21 if (res.checkResult.openBusinessView) {
22 wx.invoke(
23 'openBusinessView', {
24 businessType: 'wxpayScoreDetail',
25 queryString
26:'mch_id=1230000109&service_id=88888888000011&out_order_no=1234323JKHDFE1243252×tamp=1530097563&nonce_str=zyx53Nkey8o4bHpxTQvd8m7e92nG5mG2&sign_type=HMAC-SHA256&sign=029B52F67573D7E3BE74904BF9AEA'
27 },
28
29 function (res) {
30
31 if (parseint(res.err_code) === 0) {
32
33 } else {
34
35 }
36 });
37 }
38 }
39 });
40 }
41
42
43
44
45
46
47
48
49function compareVersion(v1, v2) {
50 v1 = v1.split('.')
51 v2 = v2.split('.')
52 const len = Math.max(v1.length, v2.length)
53
54 while (v1.length < len) {
55 v1.push('0')
56 }
57 while (v2.length < len) {
58 v2.push('0')
59 }
60
61 for (let i = 0; i < len; i++) {
62 const num1 = parseint(v1[i])
63 const num2 = parseint(v2[i])
64
65 if (num1 > num2) {
66 return 1
67 } else if (num1 < num2) {
68 return -1
69 }
70 }
71
72 return 0
73 }
返回参数
无