# CodeIdentificationService#identifyCode

> When the MPP cannot recognize the code value, use this API to check whether the code can be processed by Alipay+.

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: - `DECODE`: indicates that the code is an order code and the MPP needs to send a request to Alipay+ to decode the code value. - `OPEN_URL`: indicates that the code is an entry code and the MPP needs to redirect the user to place an order. > **Note**: Returned by Alipay+ if the value of the _isSupported_ parameter is `true`. | O |
| codeValue | String | / | The code value that is to be decoded. > **Note**: Returned by Alipay+ if the value of the _postCodeMatchActionType_ parameter is `DECODE`. | 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 `OPEN_URL`. | O |
| userAgent | String | / | The additional user-agent information that needs to be added. The default value of this parameter is `-`. > **Note**: > > - Returned by Alipay+ if the value of the _postCodeMatchActionType_ parameter is `OPEN_URL`. > - The additional user-agent string is in the format of `-/[String_Value]`. | O |
| acDecodeConfig | String | / | Extended information for Alipay+ Client SDK to use. > **Note**: Returned by Alipay+ if the value of the _isSupported_ parameter is `true`. | 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

```java
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
}
```