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

      User Information Inquiry

      Use this interface 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 Authorization Revocation interface. 

      Request parameters

      accessTokenString(128)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.

      Response parameters

      resultResultRequired

      The request result, which contains information related to the request result, such as status and error codes.

      resultCodeString(16)Required
      Result code
      resultStatusEnumRequired

      Result status. Possible values are:   

      • S: Indicates that the result status is successful. 
      • F: Indicates that the result status is failed. 
      • U: Indicates that the result status is unknown.
      resultMessageString(64)Optional
      Result message
      userIdString(64)Optional

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

      userLoginIdString(64)Optional
      The user login ID from the payment service provider. The value is a mobile phone number or an email address, and is masked.
      hashUserLoginIdString(64)Optional

      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 

      This section gives additional information about this interface and certain 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 Authorizaiton Consult interface to retrieve user information that are allowed to be shared by PMP. The scopes field defined in the Authorization 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 due to local regulations and compliance requirement even if the scope is correct. 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 country code as 1, area code as 415 and local number as 4567899. A UK mobile phone number (020) 4455 5666 in E.164 formatting is +442044555666, where 44 is the country code for UK and the leading 0 is removed from the area code 020. Therefore, the value of hashUserLoginId is going to be a hashed value of +442044555666. 

      Result process logic

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

      • If the value of result.resultStatus is S, the user information inquiry 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.
      SIGNATURE_INVALIDFThe 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 calling is failed, which is caused by unknown reasons.
      Request/Response Code

      Request

      Method

      POST

      Endpoint

      v1/users/inquiryUserInfo

      Header

      Accept: application/json

      URL

      Domain name

      Request Body
      Request parameters
      Response Body
      Body content