CodeIdentificationService#identifyCode
When the MPP cannot recognize the code value, use this API to check whether the code can be processed by Alipay+.
Request parameters
Parameters
Item | Type | Length | Description | Required |
request | CodeIdentificationIdentifyRequest | / | Code identification request | M |
CodeIdentificationIdentifyRequest
Item | Type | Length | Description | Required |
codeValue | String | 8192 | The code value that cannot be recognized by the MPP | M |
openId | String | >=3 | The parameter is used to identify whether the user is in the defined ratio or allowlist for the canary release. The value of openId must be related to the user ID, which can be userId or the hash value of userId. The value of openId is not sent to Alipay+. | M |
Response parameters
CodeIdentificationNonSdkResult
Item | Type | Length | Description | Required |
isSupported | boolean | / | The parameter indicates whether the code can be processed by Alipay+. | M |
postCodeMatchActionType | String | / | The further action that needs to be taken if the code can be processed by Alipay+. Valid values are:
Note: Returned by Alipay+ if the value of the isSupported parameter is | O |
codeValue | String | / | The code value that is to be decoded. Note: Returned by Alipay+ if the value of the postCodeMatchActionType parameter is | O |
redirectUrl | String | / | The URL to which the user needs to be redirected to place an order. Note: Returned by Alipay+ if the value of the postCodeMatchActionType parameter is | O |
userAgent | String | / | The additional user-agent information that needs to be added. The default value of this parameter is Note:
| O |
Result code
resultCode | resultStatus | resultMessage |
SUCCESS | S | Success |
PARAM_ILLEGAL | F | Illegal parameters exist. For example, a non-numeric input, or an invalid date. |
UNKNOWN_EXCEPTION | U | The API calling failed because of unknown reasons. |
Result processing logic
- If result.resultStatus is
S
, the code identification is successful. See the following list for details:
- If isSupported is
true
, the code can be processed by Alipay+.
- If postCodeMatchActionType is
DECODE
, the code is an order code and the MPP needs to send a request to Alipay+ to decode the code value. - If postCodeMatchActionType is
OPEN_URL
, the code is an entry code and the MPP needs to redirect the user to place an order based on the redirectUrl and userAgent parameters.
- If isSupported is
false
, the code cannot be processed by Alipay+.
- If result.resultStatus is
F
, code identification failed. The MPP can handle the result based on result codes. - If result.resultStatus is
U
, unknown exceptions occur during the code identification and the MPP can check logs to view details. The MPP also might retry.
Sample
CodeIdentificationIdentifyRequest request = new CodeIdentificationIdentifyRequest();
request.setCodeValue("28100104df2342342****");
CodeIdentificationIdentifyResult result = codeIdentificationService.identifyCode(request);
if (result.getResult().getResultStatus().equals("S") && result.isSupported()){
// the code should be processed by Alipay+
}
if (result.getResult().getResultStatus().equals("F"){
// Please pay attention to resultCode
}