---
page_title: 2. Initialize SDK
product: Hypercheckout
platform: Capacitor
page_source: https://juspay.io/in/docs/hyper-checkout/capacitor/base-sdk-integration/initialize-sdk
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/hyper-checkout/llms.txt
---


## 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 1 Import HyperSDK


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



#### Code Snippets: -

#### Capacitor Code Snippet:

```capacitor
import { Plugins } from '@capacitor/core';
import 'hyper-sdk-capacitor';

const { HyperServices } = Plugins;
```



### Step 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
// Importing Hyper SDK
// block:start:import-hyper-sdk

import { Plugins } from '@capacitor/core';
import 'hyper-sdk-capacitor';

const { HyperServices } = Plugins;
// block:end:import-hyper-sdk

....

  // Create Juspay Object
  // // block:start:create-hyper-sdk-instance

  await HyperServices.createHyperServices();
  // await HyperServices.createHyperServices(clientId, service) 
  //service: "in.juspay.hyperpay" (For Payment Page),"in.juspay.hyperapi" (For Express Checkout)
  //clientId : "Client shared by Juspay"
  // // block:end:create-hyper-sdk-instance
  ....


```



### Step 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” / “sandbox“.
      - Tags: String, Mandatory
  - Tags: JSON, Mandatory





### Step 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
await HyperServices.initiate(initiatePayload);
```


---

## Complete Code Reference

The following code files are referenced in the steps above:

### main.js

```
// Importing Hyper SDK
// block:start:import-hyper-sdk

import { Plugins } from '@capacitor/core';
import 'hyper-sdk-capacitor';

const { HyperServices } = Plugins;
// block:end:import-hyper-sdk

....

  // Create Juspay Object
  // // block:start:create-hyper-sdk-instance

  await HyperServices.createHyperServices();
  // await HyperServices.createHyperServices(clientId, service) 
  //service: "in.juspay.hyperpay" (For Payment Page),"in.juspay.hyperapi" (For Express Checkout)
  //clientId : "Client shared by Juspay"
  // // block:end:create-hyper-sdk-instance
  ....


```

### home.js

```

// Calling initiate on hyperSDK instance to boot up payment engine.
// block:start:initiate-sdk

await HyperServices.initiate(initiatePayload);
// block:end:initiate-sdk




```


---

## See Also

- [1. Getting SDK](https://juspay.io/in/docs/hyper-checkout/capacitor/base-sdk-integration/getting-sdk)
- [3. Rendering the Checkout Screen](https://juspay.io/in/docs/hyper-checkout/capacitor/base-sdk-integration/rendering-the-checkout-screen)
