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 | CodeIdentificationRequest | / | Code identification request | M |
CodeIdentificationRequest
Item | Type | Length | Description | Required |
codeValue | String | 8192 | The code value that cannot be recognized by the MPP | M |
Response parameters
CodeIdentificationResult
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 |
acDecodeConfig | String | / | Extended information for Alipay+ Client SDK to use. Note: Returned by Alipay+ if the value of the isSupported parameter is | 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
CodeIdentificationRequest request = new CodeIdentificationRequest();
request.setCodeValue("28100104df2342342****");
CodeIdentificationResult 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
}