getPayAuthorize 获取支付权限
getPayAuthorize ^7.9
获取支付权限(目前只支持支付宝权限获取,后续可扩展)
#请求参数
| Prop | Type | Default | Comment | 
|---|---|---|---|
| type | String | N/A | alipay | 
| data | String | N/A | 参考支付宝文档请求字符串 | 
#支付宝请求字符串 字段说明
| Prop | Type | Default | Comment | 
|---|---|---|---|
| apiname | String | 必填 | 最大长度120,服务对应的名称,常量值为 com.alipay.account.auth | 
| method | String | 必填 | 最大长度30,接口名称,常量值为 alipay.open.auth.sdk.code.get | 
| app_id | String | 必填 | 最大长度16,支付宝分配给开发者的应用 ID,示例值:2014123100022800 | 
| app_name | String | 必填 | 最大长度2,调用来源方的标识,常量值为 mc。 | 
| biz_type | String | 必填 | 最大长度11,调用业务的类型,常量值为 openservice。 | 
| pid | String | 必填 | 最大长度16,签约的支付宝账号对应的支付宝唯一用户号,以 2088 开头的 16 位纯数字组成。示例值:2088123456789012 | 
| product_id | String | 必填 | 最大长度14,产品码,常量值为 APP_FAST_LOGIN。 | 
| scope | String | 必填 | 最大长度7,授权范围,常量值为 kuaijie。 | 
| target_id | String | 必填 | 最大长度32,商户标识该次用户授权请求的 ID,该值在商户端应保持唯一。示例值:kkkkk091125 | 
| auth_type | String | 必填 | 最大长度11,标识授权类型。AUTHACCOUNT:授权。 | 
| sign_type | String | 必填 | 最大长度4,商户生成签名字符串所使用的签名算法类型,目前支持 RSA2 和 RSA,推荐使用 RSA2。 | 
| sign | String | 必填 | 最大长度344,整个授权参数信息的签名,即此行以上参数 key 和 value 通过&拼接的字符串的签名值,对此字符串签名后需做 URL 编码。 | 
说明:支付宝不强制校验该值。后续服务端调用 alipay.system.oauth.token(换取授权访问令牌)、alipay.user.info.share(支付宝会员授权信息查询接口)接口需加签、验签,能够保证流程安全。
#接口调用示例
const params = {
    "type": "alipay",
    "data": "参考支付宝文档请求字符串"
    // // 举例子:data = 'apiname=com.alipay.account.auth&app_id=xxxxx&app_name=mauth_type=AUTHACCOUNT&biz_type=openservice&method=alipay.open.auth.sdk.code.get&pid=xxxxx&product_id=APP_FAST_LOGIN&scope=kuaijie&sign_type=RSA2&target_id=20141225xxxx&sign=xxx'
}
this.$bridge
  .getPayAuthorize(params)
  .then(res => {
    this.$alert(res)
  })
  .catch(err => {
    this.$toast(err)
  })
#接口返回示例
{
    "code": 0,
    "msg": "success",
    "data": {
        "alipayOpenId": "xxx",
        "authCode": "xxx",
        "resultCode": "xxx",
        "userId": "xxx"
    }
}
 
                     
                    
                 
                    
                 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号