---
page_title: 3. Initialize SDK
product: EC Headless
platform: Capacitor
page_source: https://juspay.io/in/docs/ec-headless/capacitor/base-sdk-integration/initiating-sdk
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/ec-headless/llms.txt
---


## 3. Initiating the SDK



To initialise the SDK, client needs to call the `initiate` SDK API. The initiate api call boots up Express Checkout SDK and makes it ready for all other operations

Follow the below steps to make an initiate SDK call

> **Warning**
> Initiate is to be called in the onCreate() method of your application's main activity (Home screen). Not following this will lead to increased latency.




### Step 3.1. Import HyperSDK


Import the HyperSDK namespace to get access to HyperServices class in your code



#### Code Snippets: -

#### Capacitor Code Snippet:

```capacitor
{"success":false,"message":"Failed to fetch snippet"}
```



### Step 3.2. Create an instance of HyperServices


Express Checkout SDK exposes the `HyperServices` class. Create an object of this class for all upcoming operations



#### Code Snippets: -

#### Capacitor Code Snippet:

```capacitor
{"success":false,"message":"Failed to fetch snippet"}
```



### Step 3.3. Create Initiate payload


Initiate API takes two parameters as input. One of the parameter is a JSON object referred as `InitiatePayload`. This payload contains certain key value pairs used by the SDK to perform a successful initiate

Refer to the following table for information about the description and sample payload.


### Payload
- **RequestId**:
  - Description: Unique uuid-v4 string
  - Value: $requestId
  - Tags: String, Mandatory
- **Service**:
  - Description: Value: in.juspay.hyperapi
  - Tags: String, Mandatory
- **Payload**:
  - Description: Parameters required to call Hyper SDK API
  - Value:
    - **Action**:
      - Description: Value: initiate
      - Tags: String, Mandatory
    - **MerchantId**:
      - Description: Unique merchant id shared during onboarding
      - Tags: String, Mandatory
    - **ClientId**:
      - Description: Unique Client id shared during onboarding
      - Tags: String, Mandatory
    - **Environment**:
      - Description: Environment to be used for the session. Accepted value is production
      - Tags: String, Mandatory
  - Tags: JSON, Mandatory





### Step 3.4. Call initiate


The final step is to call the `Initiate SDK API`.

The initiate method takes two parameters: `InitiatePayload` and `HyperPaymentsCallbackAdapter`. Use the functions created in the above steps to create the parameters

> **Warning**
> Initiate is a fire-and-forget call. For every HyperService instance you should **call initiate only once.** 





#### Code Snippets: -

#### Capacitor Code Snippet:

```capacitor
{"success":false,"message":"Failed to fetch snippet"}
```


---

## Complete Code Reference

The following code files are referenced in the steps above:

### main.js

```
{"success":false,"message":"Failed to fetch snippet"}
```

### home.js

```
{"success":false,"message":"Failed to fetch snippet"}
```


---

## See Also

- [2. Creating a Customer](https://juspay.io/in/docs/ec-headless/capacitor/base-sdk-integration/creating-a-customer)
- [4. Rendering the Checkout Screen](https://juspay.io/in/docs/ec-headless/capacitor/base-sdk-integration/rendering-the-checkout-screen)
