视频一区二区三区自拍_千金肉奴隷1985未删减版在线观看_国产成人黄色视频在线播放_少女免费播放片高清在线观看_国产精品v欧美精品v

基礎支付
JSAPI支付
APP支付
H5支付
Native支付
小程序支付
合單支付
付款碼支付
經(jīng)營能力
微信支付分(公共API)
微信支付分(免確認預授權模式)
微信支付分(需確認模式)
支付即服務
行業(yè)方案
智慧商圈
微信支付分停車服務
電子發(fā)票
營銷工具
代金券
商家券
委托營銷
支付有禮
小程序發(fā)券插件
H5發(fā)券
圖片上傳(營銷專用)
現(xiàn)金紅包
資金應用
商家轉(zhuǎn)賬到零錢
分賬
風險合規(guī)
消費者投訴2.0
其他能力
清關報關
圖片上傳
視頻上傳
微信支付平臺證書

JSAPI調(diào)起支付分-授權服務

最新更新時間:2020.07.06 版本說明

商戶通過調(diào)用授權服務接口打開微信支付分小程序,引導用戶授權服務(Web端)

簡介

接口名稱: openBusinessView

接口兼容:

此接口引用 JSAPI版本1.5.0,引用地址:https://res.wx.qq.com/open/js/jweixin-1.5.0.js

要求用戶微信版本>=7.0.5

接口參數(shù)

Object

參數(shù)名 變量 類型[長度限制] 必填 描述
跳轉(zhuǎn)類型 businessType string[1,16] 固定配置:wxpayScoreEnable
示例值:wxpayScoreEnable
業(yè)務參數(shù) queryString string[1,2048] 使用URL的query string
方式傳遞參數(shù),格式為key=value&key2=value2,其中value,value2需要進行UrlEncode處理。
示例值:見querystring
示例

apply_permissions_token=zyx53Nkey8o4bHpxTQvd8m7e92nG5mG2

query內(nèi)部參數(shù)

參數(shù)名 變量 類型[長度限制] 必填 描述
預授權token apply_permissions_token string[1,2048] 用于跳轉(zhuǎn)到微信側(cè)小程序授權數(shù)據(jù),跳轉(zhuǎn)到微信側(cè)小程序傳入,有效期為1小時;apply_permissions_token可以從《商戶預授權API》接口的返回參數(shù)中獲取。
示例值:1230000109
	
let wechatInfo = navigator.userAgent.match(/MicroMessenger\/([\d\.]+)/i);
let wechatVersion = wechatInfo[1];

if (compareVersion(wechatVersion, '7.0.5') >= 0) {
   goToWXScore();
} else {
   // 提示用戶升級微信客戶端版本
   window.href = 'https://support.weixin.qq.com/cgi-bin/readtemplate?t=page/
   common_page__upgrade&text=text005&btn_text=btn_text_0'
}

/**
 * 跳轉(zhuǎn)微信支付分
 */
function goToWXScore() {
    wx.checkJsApi({
        jsApiList: ['openBusinessView'], // 需要檢測的JS接口列表
        success: function (res) {
        // 以鍵值對的形式返回,可用的api值true,不可用為false
        // 如:{"checkResult":{"openBusinessView":true},"errMsg":"checkJsApi:ok"}
        if (res.checkResult.openBusinessView) {
            wx.invoke(
                'openBusinessView', {
                    businessType: 'wxpayScoreEnable',
                    queryString: 'apply_permissions_token=zyx53Nkey8o4bHpxTQvd8m7e92nG5mG2'
                },
                function (res) {
                // 從微信側(cè)小程序返回時會執(zhí)行這個回調(diào)函數(shù)
                    if (parseint(res.err_code) === 0) {
                    // 返回成功 
                    } else {
                    // 返回失敗
                    }
                });
            }
        }
    });
 }

 /**
  * 版本號比較
  * @param {string} v1 
  * @param {string} v2 
  */
function compareVersion(v1, v2) {
    v1 = v1.split('.')
    v2 = v2.split('.')
    const len = Math.max(v1.length, v2.length)
  
    while (v1.length < len) {
      v1.push('0')
    }
    while (v2.length < len) {
      v2.push('0')
    }
  
    for (let i = 0; i < len; i++) {
      const num1 = parseint(v1[i])
      const num2 = parseint(v2[i])
  
      if (num1 > num2) {
        return 1
      } else if (num1 < num2) {
        return -1
      }
    }
  
    return 0
 }

int wxSdkVersion = api.getWXAppSupportAPI();
if (wxSdkVersion >= Build.OPEN_BUSINESS_VIEW_SDK_iNT) {
  WXOpenBusinessView.Req req = new WXOpenBusinessView.Req();
  req.businessType = "wxpayScoreEnable";
  req.query = "mch_id=1230000109&service_id=88888888000011&
  out_request_no=1234323JKHDFE1243252&
  timestamp=1530097563&nonce_str=zyx53Nkey8o4bHpxTQvd8m7e92nG5mG2&
  sign_type=HMAC-SHA256&sign=029B52F67573D7E3BE74904BF9AEA";
  req.extInfo = "{\"miniProgramType\": 0}";
  Boolean ret = api.sendReq(req);
} else {
  /*需提示用戶升級微信版本*/
}
?
/********在WXEntryActivity的onResp里面接收回調(diào),示例全碼*******/
@Override
public void onResp(BaseResp r) {
  if (r.getType() == ConstantsAPI.COMMAND_OPEN_BUSINESS_VIEW) {
    WXOpenBusinessView.Resp launchMiniProgramResp = (WXOpenBusinessView.Resp) r;
    string
text = string
.format("nextMsg=%snerrStr=%snbusinessType=%s", resp.extMsg, resp.errStr, resp.businessType); Toast.makeText(this, text, Toast.LENGTH_lONG).show(); } }

版本說明

關閉

V1.0
2019.08.23
1. JSAPI調(diào)起支付分-授權服務上線

技術咨詢

文檔反饋