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

inquiryUserInfo

POST /v1/users/inquiryUserInfo

Use the inquiryUserInfo API to query basic user information after the user authentication and authorization through an account authorization process. Merchants can use the user information to determine whether to perform the account binding process and other related operations. If merchants decide to reject the account binding, merchants need to revoke the account binding process by using the revoke interface. 

Structure

A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see: 


Note: Set the data type of each field (except array) as String. This means that you must use double quotation marks (" ") to enclose the field value. Examples:

  • If the data type of a field is Integer and its value is 20, set it as "20". 
  • If the data type of a field is Boolean and its value is true, set it as "true". 

Request parameters

accessToken String  REQUIRED

An access token that can be used to access the user resource scope. The value of this field must be identical to that of accessToken in the Access Token Application interface.

More information:

  • Maximum length: 128 characters

Response parameters

result Result  REQUIRED

The request result contains information such as status and error codes.

Show child parameters

userId String  

The unique account ID of the user, which can be the internal account ID of the payment service provider or Alipay account ID.

More information:

  • Maximum length: 64 characters

userLoginId String  

The user login ID from the payment service provider. The value is a mobile phone number or an email address, and is masked.

More information:

  • Maximum length: 64 characters

hashUserLoginId String  

An MD5 hashed version of the userLoginId. Whether or not this field is returned depends on the PMP or wallet's capability.

Note: PMP, payment method provider, is an organization that processes payment services and other value-added services on behalf of the payer.

More information:

  • Maximum length: 64 characters
API Explorer
Sample CodesRun in Sandbox

Request

URL
Request Body

Response

Response Body

More information 

This section gives additional information about this interface and other parameters. See the following list for details:

  • The returned fields in the response are determined by the scope that is authorized by the user during the authorization process. Merchants need to pass the desired scope when calling the consult interface to retrieve user information that is allowed to be shared by the PMP. The scopes field defined in the consult interface determines the returned fields of this interface with the following these rules:
    • When the value of scopes is BASE_USER_INFO, only userId is returned.
    • When the value of scopes is USER_INFO, additional user information is returned on top of userId, such as userLoginId and hashUserLoginId
    • When the value of scopes is AGREEMENT_PAY, no user information is authorized to be shared. 
  • hashUserLoginId:
    Not all payment methods can return this information even if the scope is correct. This is due to local regulations and compliance requirements. If the merchant has a desire to leverage this information, contact Alipay technical support for more details. 
    When the value of userLoginId is a mobile phone number, the phone number needs to use E.164 formatting. E.164 phone number format is +{country code}{area code with leading 0 removed}{number}. For example, +14154567899 is a US mobile phone number with 1 as the country code, 415 as the area code, and 4567899 as the local number. A UK mobile phone number (020) 4455 5666 in E.164 formatting is +442044555666, where 44 is the country code for the UK, and the leading 0 is removed from the 020 area code. Therefore, the value of hashUserLoginId is going to be a hashed value of +442044555666. 

Result process logic

For different request results, different actions need to be performed. See the following list for details:

  • If the value of result.resultStatus is S, the inquiryUserInfo request is successful.
  • If the value of result.resultStatus is F or U, retry the process. 

Result/Error codes

CodeValueMessage
SUCCESSSSuccess
INVALID_ACCESS_TOKENFInvalid access token
PARAM_ILLEGALFIllegal parameters exist. For example, a non-numeric input, or an invalid date.
PROCESS_FAILFA general business failure occurred. Do not retry.
KEY_NOT_FOUNDFThe key is not found.
ACCESS_DENIEDFAccess denied
REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.
API_INVALIDFAPI is invalid or not active.
CLIENT_INVALIDFThe client is invalid.
INVALID_SIGNATUREFThe signature is invalid.
METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTP method.
MEDIA_TYPE_NOT_ACCEPTABLEFThe server does not implement the media type that is acceptable to the client.
UNKNOWN_EXCEPTIONUAn API call failed due to unknown reasons.