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.
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
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
Request
Response
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
orU
, retry the process.
Result/Error codes
Code | Value | Message |
---|---|---|
SUCCESS | S | Success |
INVALID_ACCESS_TOKEN | F | Invalid access token |
PARAM_ILLEGAL | F | Illegal parameters exist. For example, a non-numeric input, or an invalid date. |
PROCESS_FAIL | F | A general business failure occurred. Do not retry. |
KEY_NOT_FOUND | F | The key is not found. |
ACCESS_DENIED | F | Access denied |
REQUEST_TRAFFIC_EXCEED_LIMIT | U | The request traffic exceeds the limit. |
API_INVALID | F | API is invalid or not active. |
CLIENT_INVALID | F | The client is invalid. |
INVALID_SIGNATURE | F | The signature is invalid. |
METHOD_NOT_SUPPORTED | F | The server does not implement the requested HTTP method. |
MEDIA_TYPE_NOT_ACCEPTABLE | F | The server does not implement the media type that is acceptable to the client. |
UNKNOWN_EXCEPTION | U | An API call failed due to unknown reasons. |