---
page_source: https://juspay.io/in/docs/payment-page-enterprise/react-native/base-sdk-integration/initiating-sdk
page_title: 2. Initialize SDK
---


# 2. Initiating the SDK



To initialise the SDK, client needs to call the `initiate` SDK function. The initiate function call boots up the Hypercheckout SDK and makes it ready for all other operations

Follow the below steps to make an initiate SDK call

> **Error**
> Initiate is to be called on render of the homescreen. Not following this will lead to increased Hypercheckout latency.




### Step 2.1. Import HyperSDK


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



#### Code Snippets: -

#### Functional Code Snippet:

```functional
import HyperSdkReact from 'hyper-sdk-react';
```

#### Class Code Snippet:

```class
import HyperSdkReact from 'hyper-sdk-react';
```



### Step 2.2. Create an instance of HyperServices


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



#### Code Snippets: -

#### Functional Code Snippet:

```functional
HyperSdkReact.createHyperServices();
```

#### Class Code Snippet:

```class
HyperSdkReact.createHyperServices();
```



### Step 2.3. Create Initiate payload


Initiate 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.hyperpay
  - Tags: String, Mandatory
- **Payload**:
  - Description: Parameters
  - 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




#### Code Snippets: -

#### Functional Code Snippet:

```functional
const initiate_payload = {
      requestId: uuid.v4(),
      service: 'in.juspay.hyperpay',
      payload: {
        action: 'initiate',
        merchantId: '<MERCHANT_ID>',
        clientId: '<CLIENT_ID>',
        xRoutingId: '<X_ROUTING_ID>',
        environment: 'production',
      },
    };
```

#### Class Code Snippet:

```class
const initiate_payload = {
      requestId: uuid.v4(),
      service: 'in.juspay.hyperpay',
      payload: {
        action: 'initiate',
        merchantId: '<MERCHANT_ID>',
        clientId: '<CLIENT_ID>',
        xRoutingId: '<X_ROUTING_ID>',
        environment: 'production',
      },
    };
```



### Step 2.4. Call initiate


The final step is to call the `Initiate`function

The initiate method takes stringified `InitiatePayload` as argument. 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: -

#### Functional Code Snippet:

```functional
HyperSdkReact.initiate(JSON.stringify(initiate_payload));
```

#### Class Code Snippet:

```class
HyperSdkReact.initiate(JSON.stringify(initiate_payload));
```
