2024年12月22日 星期日

支付宝文档

生活号/H5 内获取用户信息 - 支付宝文档中心:
https://opendocs.alipay.com/open/02xtl8?pathHash=e39a95b3

PC授权地址

https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=APPID&scope=SCOPE&redirect_uri=ENCODED_URL

https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=2021003111607306&scope=auth_base&redirect_uri=https%3A%2F%2Falipay-agree.fjycnet.com%2Fdemo%2Findex%2Ftest

HTML测试

支付宝用户授权,静默授权

https://alipay-agree.fjycnet.com/index.html

接收回调参数

https://alipay-agree.fjycnet.com/demo/index/test

已配置支付宝PHP的SDK

测试
https://alipay-agree.fjycnet.com/pay/deel/opencheck

换取令牌
https://alipay-agree.fjycnet.com/pay/deel/aliAuth

H5适配代码

HTML页面,获取授权码

 <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    </head>
    <h1>444</h1>

<script src = "https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js"> </script> 
<button id = "test" style="font-size:50px"> getAuthCode </button>
<script>
 document.querySelector('#test').addEventListener('click',function(){
    ap.getAuthCode ({
      appId :  '2021003111607306' ,
      scopes : ['auth_base'],
   },function(res){
      ap.alert (JSON.stringify(res));
   });
});
</script>
</html>

授权码

{"authCode":"9217cef6374147e2af145ea0536fNB05","authErrorScopes".
{},"authSuccessScopes":
["auth_base"],"authcode"."9217cef6374147e2af145ea0536fNB05"}
作者:李世民  创建时间:2024-12-22 23:08
最后编辑:李世民  更新时间:2025-02-02 09:30