# activatePayment

Call the **activatePayment** API to activate the Host Card Emulation (HCE) payment function.

## Method signature

```java
void activatePayment(NFCActivateParams params, @Nullable ACResultCallback<Integer> callback);
```

## Request parameters

| **Item** | **Type** | **Description** | **Required** |
| --- | --- | --- | --- |
| params | [NFCActivateParams](#Kmgu8) | HCE configurations. | Optional |
| callback | [ACResultCallback](ac_result_callback)<Integer> | The HCE activation result. For the result codes, see [Result codes](#pF8p0). | Optional |

### NFCActivateParams

| **Item** | **Type** | **Description** | **Required** | **Default value** |
| --- | --- | --- | --- | --- |
| silentActivate | Boolean | Whether to process silent activation. Only used when _isNeedConfirmActivate_ is set to `true` when initializing the SDK through the **init** API. | Optional | false |
| replenishOnce | Boolean | Whether to automatically trigger a replenishment after successful card activation. | Optional | true |
| doConfirm | Boolean | Whether the secondary confirmation is being processed. | Optional | false |

### Result codes

| **Code** | **SDK constant** | **HCE status** |
| --- | --- | --- |
| \-3 | TOKEN\_WB\_UNAVAILABLE | White box is crashed. |
| \-2 | TOKEN\_NOT\_CONNECTED | SDK is not connected. |
| \-1 | TOKEN\_STATUS\_UNKNOWN | Token status is unknown. |
| 0 | TOKEN\_STATUS\_NOT\_EXIST | Failed to activate HCE. |
| 1 | TOKEN\_STATUS\_ACTIVATED\_WITH\_NO\_CREDENTIALS | HCE is activated successfully but Credentials are not obtained. Call the **replenish** API to obtain Credentials. |
| 2 | TOKEN\_STATUS\_READY\_TO\_TAP | HCE is activated successfully and Credentials are obtained successfully. |
| 3 | TOKEN\_STATUS\_LOCKED | Cannot execute activation as the token is locked. |
| 4 | TOKEN\_STATUS\_LOCAL\_LOCK | Cannot execute activation as the token is locked locally. |
| 11 | TOKEN\_STATUS\_IN\_PROGRESS | Activation is in progress. |
| 21 | TOKEN\_STATUS\_NOT\_CONFIRMED | Token status is not confirmed. |

## Response parameters

N/A

## Sample

```java
manager = ACTapManager.getInstance(this.getApplication())
manager.activatePayment(params, (result, errorCode, errorMsg) ->
                        log("Activation Result：" + result + "    errorCode:" + errorCode + "  errorMsg:" + errorMsg)
                       );
```