Apply for Access Token

POST /api/open/v1/alipayhk/merchant/applyToken

Use this interface to request access token with the authorization code retrieved.


Request Headers

Please check API Structure for basics.


Response Headers

Please check API Structure for basics.



Request parameters

grantType string  REQUIRED

A string indicates the purpose of this request.

  • AUTHORIZATION_CODE: Exchange for an access token.

authCode string  

The authorization code for exchanging access token, given in the redirect url as a query parameter.

The authCode is only valid for 10 minutes.

authClientId string  

The authClientId indicate which merchant will use to obtain the user information.

Response parameters

result Result  REQUIRED

A metadata object indicates the result of the request.

Show child parameters

customerId string  

The AlipayHK user ID of this authorization process.

accessToken string  

An access token to access user information.

accessTokenExpiryTime string  

Expiry time of the accessToken.

More information:

  • The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".

refreshToken string  

A refresh token for exchanging a new access token when the original one expires.

refreshTokenExpiryTime string  

Expiry time of the refreshToken.

More information:

  • The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
API Explorer

Request

Request Body

Response

Response Body

Result/Error codes

CodeValueMessage
SUCCESSSSuccess
AUTH_CODE_EXPIREDFThe authCode has expired, ask user to perform the authorization flow again.
INVALID_AUTHCODEFThe authCode is invalid.
PARAM_ILLEGALFPlease check the parameters of request.
PROCESS_FAILFBusiness process failure, do not retry.
USER_NOT_EXISTFNo user was found with this authCode.
USER_STATUS_ABNORMALFThe status of user with authCode is abnormal.
UNKNOWN_EXCEPTIONUAPI failed due to unknown reason, please check with support.