Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

alipay.user.info.share

This interface is used for Alipay users information sharing based on authorization.

📎alipay.user.info.share.html

Authorization is required

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

EnvironmentHTTPS request URL
Production environmenthttps://openapi.alipay.com/gateway.do

Publis request parameters

ParameterTypeRequiredMax lengthDescriptionSample
app_idStringY32The app ID that Alipay assigns to the developer.2014072300007148
methodStringY128The API name.alipay.user.info.share
formatStringN40Only JSON is supported.JSON
charsetStringY10Request encoding format. Such as utf-8, gbk, and gb2312.utf-8
sign_typeStringY10The signature algorithm used by the merchant to generate the sign string. Currently, RSA and RSA2 are supported. RSA2 is preferred.RSA2
signStringY256The sign string of the merchant’s request parameters. For details, see Signature.For details, see the example.
timestampStringY19The time when the request is sent. Format: "yyyy-MM-dd HH:mm:ss”.2014-07-24 03:07:50
versionStringY3The API version. The value is fixed to be 1.0.1.0
auth_tokenStringN40For details, see User information authorization.
app_auth_tokenStringN40For details, see Overview of the app authorization.

Public response parameters

ParameterTypeRequiredMax lengthDescriptionSample
codeStringY-The gateway return code. For details, see the gateway error code.40004
msgStringY-The description of gateway return code. For details, see the gateway error codeBusiness Failed
sub_codeStringN-The business return code. Refer to specific API documents for details.ACQ.TRADE_HAS_SUCCESS
sub_msgStringN-Description of the business return code. Refer to the specific API documents for details.The transaction is paid.
signStringY-Signature. For details, see the signature document.DZXh8eeTuAHoYE3w1J+POiPhfDxOYBfUNn1lkeT/V7P4zJdyojWEa6IZs6Hz0yDW5Cp/viufUb5I0/V5WENS3OYR8zRedqo6D+fUTdLHdc+EFyCkiQhBxIzgngPdPdfp1PIS7BdhhzrsZHbRqb7o4k3Dxc+AAnFauu4V6Zdwczo=

Response parameters

ParameterTypeRequiredMax lengthDescriptionSample
user_idStringY16Users’ unique Alipay user ID2088102150477652
avatarStringY400The URL of the user’s avatar.http://tfsimg.alipay.com/images/partner/T1uIxXXbpXXXXXXXX
provinceStringY20Province name.Anhui province
cityStringY20City name.Anqing
nick_nameStringY50User’s nickname.Alipay Xiao’er
is_student_certifiedStringY1Student or not? T or F.)T
user_typeStringN2User type(1/2)
  1. 1: Company account
  2. 2: Individual account
1
user_statusStringN2Userstatus(Q/T/B/W)
  1. Q: Users that has registered.
  2. T: Users that are authenticated.
  3. B: Users whose accounts are frozen.
  4. W: Users who have registered but not activated accounts.
T
is_certifiedStringN1Pass the real-name authentication?
  1. T: Passed
  2. F: Not yet
T
genderStringN10Gender
  1. F:Female
  2. M:Male
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

Public error codes

Error codeDescriptionSolution
SYSTEM_ERRORSystem busySystem error, please try again later.