商戶通過(guò)調(diào)用訂單詳情接口打開(kāi)微信支付分小程序,引導(dǎo)用戶查看訂單詳情(Web端)
# 接口說(shuō)明
支持商戶: 【普通服務(wù)商】
接口名稱: openBusinessView
# 接口兼容
此接口引用 JSAPI版本1.5.0,引用地址:https://res.wx.qq.com/open/js/jweixin-1.5.0.js (opens new window)
# 接口參數(shù)
# Object
- businessType 必填 string(16)固定配置:wxpayScoreDetail。
- queryString 必填 string(2048)使用URL的query string方式傳遞參數(shù),格式為key=value&key2=value2,其中value,value2需要進(jìn)行UrlEncode處理。
- 屬性
- envVersion 選填 string(128)要打開(kāi)的小程序版本。僅在當(dāng)前小程序?yàn)殚_(kāi)發(fā)版或體驗(yàn)版時(shí)此參數(shù)有效。如果當(dāng)前小程序是正式版,則打開(kāi)的小程序必定是正式版。取值:release:正式版;trial:體驗(yàn)版;develop:開(kāi)發(fā)版
query示例
1mch_id=1230000109&service_id=88888888000011&out_order_no=1234323JKHDFE1243252&2timestamp=1530097563&nonce_str=zyx53Nkey8o4bHpxTQvd8m7e92nG5mG2&sign_type=HMAC-SHA256&sign=029B52F67573D7E3BE74904BF9AEA
示例
1wx.checkJsApi({2 jsApiList: ['openBusinessView'], // 需要檢測(cè)的JS接口列表3 success: function(res) {4 // 以鍵值對(duì)的形式返回,可用的api值true,不可用為false5 // 如:{"checkResult":{"openBusinessView":true},"errMsg":"checkJsApi:ok"}6 if (res.checkResult.openBusinessView) {7 wx.invoke('openBusinessView', {8 businessType: 'wxpayScoreDetail',9 queryString: 'mch_id=1230000109&service_id=88888888000011&out_order_no=1234323JKHDFE1243252&10 timestamp=1530097563&nonce_str=zyx53Nkey8o4bHpxTQvd8m7e92nG5mG2&sign_type=HMAC-SHA256&sign=029B52F67573D7E3BE74904BF9AEA'11 }, function (res) {12 // 從微信側(cè)小程序返回時(shí)會(huì)執(zhí)行這個(gè)回調(diào)函數(shù)13 if (parseint(res.err_code) === 0) {14 // 返回成功 15 } else {16 // 返回失敗17 }18 })19 } else {20 // 提示用戶升級(jí)微信客戶端版本21 window.href = 'https://support.weixin.qq.com/cgi-bin/readtemplate?t=page/common_page__upgrade&text=text005&btn_text=btn_text_0'22 }23 }24});