method | 说明 | 参数 | 返回值 |
---|---|---|---|
getToken | 获取access_token和user_id | array $order | Collection |
doGetUserInfo | 获取会员信息 | array $order | Collection |
换取授权访问令牌
$pay = new \fengkui\Pay\Alipay($alipayConfig);
$result = $pay->getToken(); // 直接跳转(静默授权:auth_base)
$result = $pay->getToken(false); // 直接跳转(主动授权:auth_user)
echo $result;
配置参数
PC 网页内获取用户信息,操作获取流程「这里」。
返回示例
{
"alipay_system_oauth_token_response": {
"user_id": "2088102150477652",
"open_id": "074a1CcTG1LelxKe4xQC0zgNdId0nxi95b5lsNpazWYoCo5",
"access_token": "20120823ac6ffaa4d2d84e7384bf983531473993",
"expires_in": "3600",
"refresh_token": "20120823ac6ffdsdf2d84e7384bf983531473993",
"re_expires_in": "3600",
"auth_start": "2010-11-11 11:11:11"
},
"sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}
支付宝会员信息查询接口
$pay = new \fengkui\Pay\Alipay($alipayConfig);
$token = ''; //授权token
$result = $pay->doGetUserInfo($token);
配置参数
所有配置参数和官方无异,参数请查看「业务响应参数」一栏。
返回示例
{
"alipay_user_info_share_response": {
"code": "10000",
"msg": "Success",
"user_id": "2088102104794936",
"avatar": "http://tfsimg.alipay.com/images/partner/T1uIxXXbpXXXXXXXX",
"city": "安庆",
"nick_name": "支付宝小二",
"province": "安徽省",
"gender": "F"
},
"sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}