alipay.user.info.share
This interface is used for Alipay users information sharing based on authorization.
The proxy call by third parties is supported
This API, together with the alipay.system.oauth.token API, is used to query the user information that is authorized to be shared.
Public parameters
Request URL
Environment | HTTPS request URL |
Production environment | https://openapi.alipay.com/gateway.do |
Publis request parameters
Parameter | Type | Required | Max length | Description | Sample |
app_id | String | Y | 32 | The app ID that Alipay assigns to the developer. | 2014072300007148 |
method | String | Y | 128 | The API name. | alipay.user.info.share |
format | String | N | 40 | Only JSON is supported. | JSON |
charset | String | Y | 10 | Request encoding format. Such as utf-8, gbk, and gb2312. | utf-8 |
sign_type | String | Y | 10 | The signature algorithm used by the merchant to generate the sign string. Currently, RSA and RSA2 are supported. RSA2 is preferred. | RSA2 |
sign | String | Y | 256 | The sign string of the merchant’s request parameters. For details, see Signature. | For details, see the example. |
timestamp | String | Y | 19 | The time when the request is sent. Format: "yyyy-MM-dd HH:mm:ss”. | 2014-07-24 03:07:50 |
version | String | Y | 3 | The API version. The value is fixed to be 1.0. | 1.0 |
auth_token | String | N | 40 | For details, see User information authorization. | |
app_auth_token | String | N | 40 | For details, see Overview of the app authorization. |
Public response parameters
Parameter | Type | Required | Max length | Description | Sample |
code | String | Y | - | The gateway return code. For details, see the gateway error code. | 40004 |
msg | String | Y | - | The description of gateway return code. For details, see the gateway error code | Business Failed |
sub_code | String | N | - | The business return code. Refer to specific API documents for details. | ACQ.TRADE_HAS_SUCCESS |
sub_msg | String | N | - | Description of the business return code. Refer to the specific API documents for details. | The transaction is paid. |
sign | String | Y | - | Signature. For details, see the signature document. | DZXh8eeTuAHoYE3w1J+POiPhfDxOYBfUNn1lkeT/V7P4zJdyojWEa6IZs6Hz0yDW5Cp/viufUb5I0/V5WENS3OYR8zRedqo6D+fUTdLHdc+EFyCkiQhBxIzgngPdPdfp1PIS7BdhhzrsZHbRqb7o4k3Dxc+AAnFauu4V6Zdwczo= |
Response parameters
Parameter | Type | Required | Max length | Description | Sample |
user_id | String | Y | 16 | Users’ unique Alipay user ID | 2088102150477652 |
avatar | String | Y | 400 | The URL of the user’s avatar. | http://tfsimg.alipay.com/images/partner/T1uIxXXbpXXXXXXXX |
province | String | Y | 20 | Province name. | Anhui province |
city | String | Y | 20 | City name. | Anqing |
nick_name | String | Y | 50 | User’s nickname. | Alipay Xiao’er |
is_student_certified | String | Y | 1 | Student or not? T or F.) | T |
user_type | String | N | 2 | User type(1/2)
| 1 |
user_status | String | N | 2 | Userstatus(Q/T/B/W)
| T |
is_certified | String | N | 1 | Pass the real-name authentication?
| T |
gender | String | N | 10 | Gender
| F |
Request samples
JAVA
copy
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2");
AlipayUserInfoShareRequest request = new AlipayUserInfoShareRequest();
AlipayUserInfoShareResponse response = alipayClient.execute(request,accessToken);
if(response.isSuccess()){
System.out.println("Call succeeds");
} else {
System.out.println("Call fails");
}
.NET
copy
IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", "app_id", "merchant_private_key", "json", "1.0", "RSA2", "alipay_public_key", "GBK", false);
AlipayUserInfoShareRequest request= new AlipayUserInfoShareRequest() ;
AlipayUserInfoShareResponse response=client.execute(request,accessToken);
Console.WriteLine(response.Body);
PHP
copy
$aop = new AopClient ();
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
$aop->appId = 'your app_id';
$aop->rsaPrivateKey = 'Please fill in the developer's private key in a line of string, moving the head, tail, and carriage return';
$aop->alipayrsaPublicKey='Please fill in Alipay public key in a line of string';
$aop->apiVersion = '1.0';
$aop->signType = 'RSA2';
$aop->postCharset='GBK';
$aop->format='json';
$request = new AlipayUserInfoShareRequest ();
$result = $aop->execute ( $request , $accessToken );
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
if(!empty($resultCode)&&$resultCode == 10000){
echo "Successful";
} else {
echo "Failed";
}
HTTP request source code
copy
https://openapi.alipay.com/gateway.do?timestamp=2013-01-01 08:08:08&method=alipay.user.info.share&app_id=4532&sign_type=RSA2&sign=ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE&version=1.0&auth_token=20130319e9b8d53d09034da8998caefa756c4006
//To ensure a secure communication, verify whether the sign value in the response sample is provided by Ant finance.
Response samples
JSON
copy
{
"alipay_user_info_share_response": {
"code": "10000",
"msg": "Success",
"user_id": "2088102104794936",
"avatar": "http://tfsimg.alipay.com/images/partner/T1uIxXXbpXXXXXXXX",
"province": "Anhui province",
"city": "Anqing",
"nick_name": "Alipay Xiao'er",
"is_student_certified": "T",
"user_type": "1",
"user_status": "T",
"is_certified": "T",
"gender": "F"
},
XML
copy
<alipay_user_info_share_response>
<code>10000</code>
<msg>Success</msg> <user_id>2088102104794936</user_id>
<taobao_id>42143928</taobao_id>
<avatar>http://tfsimg.alipay.com/images/partner/T1uIxXXbpXXXXXXXX</avatar>
<phone>0511-26888888</phone>
<member_grade>primary,common;
golden,golden;
platinum,platinum;
diamond,diamond;
unknown,unknown。</member_grade>
<country_code>CN</country_code>
<province> Anhui province</province>
<city>Anqing</city>
<area>Xihu district</area>
<address>Global plaza, Wensan Rd, Xihu district</address>
<zip>3600</zip>
<nick_name>Alipay Xiao'er</nick_name>
<is_balance_frozen>T</is_balance_frozen>
<is_student_certified>T</is_student_certified>
<user_type>1</user_type>
<user_status>T</user_status>
<email>sss@163.com</email>
<user_name>Zhang San</user_name>
<mobile>13429199999</mobile>
<is_certified>T</is_certified>
<cert_type>7</cert_type>
<cert_no>340928109890871722</cert_no>
<gender>F</gender>
<person_birthday>19900101</person_birthday>
<profession>Teacher</profession>
<person_cert_expiry_date>20400101</person_cert_expiry_date>
<person_pictures list="true">
<alipay_user_picture>
<picture_url>oss-dev-fccertifycenter-01/fc550af2-d038-4665-82f0-939bdf3d3650.jpg</picture_url>
<picture_type>LICENCE</picture_type>
</alipay_user_picture>
</person_pictures>
<license_no>371702118008810</license_no>
<business_scope>Catering</business_scope>
<license_expiry_date>20200101</license_expiry_date>
<organization_code>Not available yet</organization_code>
<firm_pictures list="true">
<alipay_user_picture>
<picture_url>oss-dev-fccertifycenter-01/fc550af2-d038-4665-82f0-939bdf3d3650.jpg</picture_url>
<picture_type>LICENCE</picture_type>
</alipay_user_picture>
</firm_pictures>
<firm_type>CO</firm_type>
<firm_legal_person_name>Li Si</firm_legal_person_name>
<firm_legal_person_cert_no>320231196408110099</firm_legal_person_cert_no>
<firm_legal_person_cert_type>1</firm_legal_person_cert_type>
<firm_legal_person_cert_expiry_date>20200909</firm_legal_person_cert_expiry_date>
<firm_legal_person_pictures list="true">
<alipay_user_picture>
<picture_url>oss-dev-fccertifycenter-01/fc550af2-d038-4665-82f0-939bdf3d3650.jpg</picture_url>
<picture_type>LICENCE</picture_type>
</alipay_user_picture>
</firm_legal_person_pictures>
<firm_agent_person_name>Wangz Wu</firm_agent_person_name>
<firm_agent_person_cert_no>320322197712211890</firm_agent_person_cert_no>
<firm_agent_person_cert_type>0</firm_agent_person_cert_type>
<firm_agent_person_cert_expiry_date>20201212</firm_agent_person_cert_expiry_date>
<deliver_addresses list="true">
<alipay_user_deliver_address>
<deliver_mobile>13833334444</deliver_mobile>
<deliver_phone>0517-28888888</deliver_phone>
<address>No. XX, XX Rd </address>
<zip>310000</zip>
<deliver_province>Zhejiang</deliver_province>
<deliver_city>Hangzhou</deliver_city>
<deliver_area>Xihu district</deliver_area>
<address_code>100</address_code>
<deliver_fullname>Zhang San</deliver_fullname>
<default_deliver_address>T</default_deliver_address>
</alipay_user_deliver_address>
</deliver_addresses>
</alipay_user_info_share_response>
Exceptional sample
JSON
copy
{
"error_response": {
"code": "20000",
"msg": "Service Currently Unavailable",
"sub_code": "isp.unknow-error",
"sub_msg": "System busy"
},
"sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}
Business error codes
Error code | Description | Solution |
SYSTEM_ERROR | System busy | System error, please try again later. |