Alipay+ DocsAlipay+ Docs

prepareAuthInfoMPP Alipay+

The prepareAuthInfo API is used by Mobile Payment Partners (MPPs) for transactions conducted in mainland China. After a consumer scans the QR code presented by the merchant, the merchant is redirected to the AlipayCN authorization page. The wallet intercepts this redirection and forwards the AlipayCN authorization URL to Alipay+. Alipay+ then parses it and returns the authorization information, such as the merchant's redirect URL, back to the wallet. The authorization information is used for the subsequent process where the merchant obtains the user ID.

Structure

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

Note: 

1. Set the data type of each parameter (except array) as String. This means that you must use double quotation marks (" ") to enclose the parameter value. For example:

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

2. For optional parameters that are not required in your case, you can take one of the following actions:

  • Exclude the parameters from the request body.
  • Set the parameter values as null (without the double quotation marks). 

Do NOT leave the optional parameters empty by setting their values as ""; otherwise, an error might occur. 

Request parameters

authUrl string  REQUIRED

The redirection URL to the AlipayCN authorization page, obtained by intercepting the merchant's redirection process.

More information:

  • Maximum length: 2048 characters

acquirerId string  REQUIRED

The unique ID that is assigned by Alipay+ to identify an ACQP.

The fixed value of AlipayCN is 1022088000000000001.

More information:

  • Maximum length: 64 characters

Response parameters

result Result  REQUIRED

The result of the processing, including the result code, result status, and result message. For more information about how to handle the result in different payment scenarios, see How to return the result.

Show child parameters

acquirerId string  

The unique ID that is assigned by Alipay+ to identify an ACQP.

Note: This parameter is returned by Alipay+ if the value of the result.resultCode parameter is SUCCESS.

More information:

  • Maximum length: 64 characters

pspId string  

The unique ID that is assigned by Alipay+ to identify an MPP.

Note: This parameter is returned by Alipay+ if the value of the result.resultCode parameter is SUCCESS.

More information:

  • Maximum length: 64 characters

authClientId string  

The authorization object.

Note: This parameter is returned by Alipay+ if the value of the result.resultCode parameter is SUCCESS.

More information:

  • Maximum length: 64 characters

authRedirectUrl string  

The merchant's redirect URL. After generating the authCode, the wallet appends the authCode to the redirect URL and redirects back to the merchant with the URL.

Note: This parameter is returned by Alipay+ if the value of the result.resultCode parameter is SUCCESS.

More information:

  • Maximum length: 1024 characters

scopes Array  

The authorization scope. The value must be BASE_USER_INFO.

Note: This parameter is returned by Alipay+ if the value of the result.resultCode parameter is SUCCESS.

API Explorer

Request

Request Body

Response

Response Body

More information

How to handle the result

You might receive different results from Alipay+. Follow the instructions below to handle the result.

result.resultStatus

result.resultCode

Request status

Actions

S

SUCCESS

Successful

Continue processing.

F

Multiple possible values exist, such as

PARAM_ILLEGAL and

PROCESS_FAIL.

Failed

Take action based on the result code (specified in result.resultCode ). For more information, see the result codes in the below section.

U

Multiple possible values exist, such as

REQUEST_TRAFFIC_EXCEED_LIMIT and

UNKNOWN_EXCEPTION.

Unknown

Retry the request.

No result received

Unknown

Retry the request.

 

Result/Error codes

CodeValueMessage
SUCCESSSSuccess
ACCESS_DENIEDFAccess is denied.
INVALID_APIFAPI is invalid or not active.
INVALID_CLIENTFThe client is invalid.
INVALID_SIGNATUREFThe signature is invalid.
KEY_NOT_FOUNDFThe key is not found.
METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTP method.
MEDIA_TYPE_NOT_ACCEPTABLEFThe server does not implement the media type that would be acceptable to the client.
PARAM_ILLEGALFIllegal parameters exist. For example, a non-numeric input or an invalid date.
PROCESS_FAILFGeneral business failure. Do not retry.
QUOTE_NOT_FOUNDFThere is no valid quote.
REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.
UNKNOWN_EXCEPTIONUThe API call failed because of unknown reasons.