---
page_title: Initiating the SDK
product: UPI Plugin SDK
platform: iOS
page_source: https://juspay.io/in/docs/upi-plugin-sdk/ios/interaction-with-sdk/initiating-the-sdk
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/upi-plugin-sdk/llms.txt
---


## Initiating the SDK



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

Follow the below steps to make an initiate SDK call:


### Step 1 Import HyperSDK


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



#### Code Snippets: -

#### Objective-C Code Snippet:

```objective-c
#import <HyperSDK/HyperSDK.h>
```

#### Swift Code Snippet:

```swift
import HyperSDK
```



### Step 2 Create an instance of HyperServices


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



#### Code Snippets: -

#### Objective-C Code Snippet:

```objective-c
self.hyperInstance = [[HyperServices alloc] init];
```

#### Swift Code Snippet:

```swift
let hyperInstance = HyperServices();
```



### 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.



#### Code Snippets: -

#### Objective-C Code Snippet:

```objective-c
- (NSDictionary *)createInitiatePayload {

    NSDictionary *innerPayload = @{
        @"action": @"initiate",
        @"merchantKeyId": @"<MERCHANT_KEY_ID>",
        @"clientId": @"<CLIENT_ID>",
        @"environment": @"production",
        @"issuingPsp": @"YES_BIZ",
        @"signature": @"....",
        @"signaturePayload": signaturePayload
    };

    // block:start:generatingRequestId
    NSUUID *uuid = [NSUUID UUID];
    NSString *requestId = [uuid UUIDString];
    // block:end:generatingRequestId

    NSDictionary *sdkPayload = @{
        @"requestId": requestId,
        @"service": @"in.juspay.hyperapi",
        @"payload": innerPayload
    };

    NSDictionary *ignaturePayload = @{
        @"merchant_id": @"<MERCHANT_ID>",
        @"customer_id": @"<CUSTOMER_ID>",
        @"timestamp": @"<timestamp>"
    };

    return sdkPayload;
}
```

#### Swift Code Snippet:

```swift
func createInitiatePayload() -> [String: Any] {
        let innerPayload : [String: Any] = [
            "action": "initiate",
            "merchantKeyId": "<MERCHANT_KEY_ID>",
            "clientId": "<CLIENT_ID>",
            "environment": "production",
            "issuingPsp": "YES_BIZ",
            "signature": "....",
            "signaturePayload": signaturePayload
        ];

        let sdkPayload : [String: Any] = [
            // block:start:generatingRequestId
            "requestId": UUID().uuidString,
            // block:start:generatingRequestId
            "service": "in.juspay.hyperapi",
            "payload": innerPayload
        ]

        let signaturePayload : [String: Any] = [
            "merchant_id": "<MERCHANT_ID>",
            "customer_id": "<CUSTOMER_ID>",
            "timestamp": "<timestamp>"
        ]

        return sdkPayload
    }
```



###   Initiate Parameters - Signature Support



## Request 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: Operation to be performed in the SDK. Should be initiate for this call.
      - Value: Value: initiate
      - Tags: String, Mandatory
    - **ClientId**:
      - Description: Client Id assigned by juspay. Usual convention is merchant_id
      - Value: Example: stock
      - Tags: String, Mandatory
    - **Environment**:
      - Description: Environment to be used for the session, while in testing it is sandbox and production when we are moving to releasing this app. Accepted values are 'sandbox' or 'production'
      - Value: Example: sandbox
      - Tags: String, Mandatory
    - **IssuingPsp**:
      - Description: Bank on which the merchant has been onboarded.
      - Value: Example: YES_BIZ/AXIS_BIZ
      - Tags: String, Mandatory
    - **MerchantKeyId**:
      - Description: Key ID to identify the public-private key pair used for signature generation.
      - Value: Example: 1234
      - Tags: String, Mandatory
    - **Signature**:
      - Description: Generated signature for signature payload. See signature generation process in pre-requisites section.
      - Tags: String, Mandatory
    - **SignaturePayload**:
      - Description: Signature payload is a stringified JSON of the details mentioned in the below table.
      - Value:
        - **Merchant_id**:
          - Description: Unique identifier associated with an account created by juspay.
          - Value: Example: stock
          - Tags: String, Mandatory
        - **Customer_id**:
          - Description: Any unique reference associated with your customer.
          - Value: Example: abcde12345
          - Tags: String, Mandatory
        - **Timestamp**:
          - Description: Time when request is created in milliseconds.
          - Value: Example: 1665996901100
          - Tags: String, Mandatory
      - Tags: String, Mandatory
    - **ShouldCreateCustomer**:
      - Description: Value: true
      - Value: Value: true
      - Tags: Boolean, Mandatory
    - **MerchantLoader**:
      - Description: This key can be passed to so that merchant can show their own loaders and as well get the loader related events from the SDK, by default it’s value is false
      - Value: Value: false
      - Tags: Boolean, Optional
  - Tags: JSON, Mandatory


## Response 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: Operation performed in the SDK.
      - Value: Value: initiate
      - Tags: String
    - **Status**:
      - Description: Status of the Operation.
      - Value: Possible values : SUCCESS / FAILURE
      - Tags: String
  - Tags: JSON, Mandatory



> **Note**
> [Click here](../miscellaneous/additional-parameters) for additional initiate parameters





#### Code Snippets: -

#### Swift Code Snippet:

```swift
{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "initiate",
    "merchantKeyId": "<Merchant Key Id>",
    "clientId": "<Client Id>",
    "merchantLoader": false,
    "signature": "<Generated signature for signature payload>",
    "signaturePayload": "<Stringified signature payload>",
    "environment": "sandbox",
    "upiEnvironment": "sandbox"
    "issuingPsp": "YES_BIZ",
    "shouldCreateCustomer": true,
    "logLevel": 1
  }
}

"signaturePayload": {
  "merchant_id": "stock",
  "customer_id": "abcde12345",
  "timestamp": "1668389349848"
}
```

#### Objective-C Code Snippet:

```objective-c
{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "initiate",
    "merchantKeyId": "<Merchant Key Id>",
    "clientId": "<Client Id>",
    "merchantLoader": false,
    "signature": "<Generated signature for signature payload>",
    "signaturePayload": "<Stringified signature payload>",
    "environment": "sandbox",
    "upiEnvironment": "sandbox"
    "issuingPsp": "YES_BIZ",
    "shouldCreateCustomer": true,
    "logLevel": 1
  }
}

"signaturePayload": {
  "merchant_id": "stock",
  "customer_id": "abcde12345",
  "timestamp": "1668389349848"
}
```



###   Initiate Parameters - ClientAuthToken Support



## Request 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: Operation to be performed in the SDK. Should be initiate for this call.
      - Value: Value: initiate
      - Tags: String, Mandatory
    - **ClientId**:
      - Description: Client Id assigned by juspay. Usual convention is merchant_id
      - Value: Example: stock
      - Tags: String, Mandatory
    - **Environment**:
      - Description: Environment to be used for the session, while in testing it is sandbox and production when we are moving to releasing this app. Accepted values are 'sandbox' or 'production'
      - Value: Example: sandbox
      - Tags: String, Mandatory
    - **MerchantId **:
      - Description: Key ID to identify the public-private key pair used for signature generation.
      - Value: Example: 1234
      - Tags: String, Mandatory
    - **CustomerId**:
      - Description: Any unique reference associated with your customer.
      - Value: Example: 12345
      - Tags: String, Mandatory
    - **IssuingPsp**:
      - Description: Bank on which the merchant has been onboarded.
      - Value: Example: YES_BIZ/AXIS_BIZ
      - Tags: String, Mandatory
    - **ClientAuthToken**:
      - Description: clientAuthToken as returned from clientAuthToken generation
      - Value: Example: tkn_2p2k1b6d26eg4740b9ef01294d3a43b4
      - Tags: String, Optional
    - **AuthExpiry**:
      - Description: Default 15min (functionality to be extended if configuration to change signature expiry is added)
      - Value: Example: 2021-07-19T07:20:53.318Z
      - Tags: String, Optional
    - **ShouldCreateCustomer**:
      - Description: true if customer is not registered, false if customer already created via Get Customer.
      - Value: Example: true
      - Tags: Boolean, Mandatory
    - **MerchantLoader**:
      - Description: This key can be passed to so that merchant can show their own loaders and as well get the loader related events from the SDK, by default it’s value is false
      - Value: Value: false
      - Tags: Boolean, Optional
  - Tags: JSON, Mandatory


## Response 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: Operation performed in the SDK.
      - Value: Value: initiate
      - Tags: String
    - **Status**:
      - Description: Status of the Operation.
      - Value: Possible values : SUCCESS / FAILURE
      - Tags: String
  - Tags: JSON, Mandatory



> **Note**
> [Click here](../miscellaneous/additional-parameters) for additional initiate parameters





#### Code Snippets: -

#### Objective-C Code Snippet:

```objective-c
{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "initiate",
    "clientId": "<Client Id>",
    "environment": "sandbox",
    "merchantLoader": false,
    "clientAuthToken": "<clientAuthToken>",
    "authExpiry" : "2023-07-19T14:15:40Z",
    "shouldCreateCustomer": true,
    "merchantId": "stock",
    "issuingPsp": "YES_BIZ",
    "customerId": "abcde12345",
  }
}
```

#### Swift Code Snippet:

```swift
{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "initiate",
    "clientId": "<Client Id>",
    "environment": "sandbox",
    "merchantLoader": false,
    "clientAuthToken": "<clientAuthToken>",
    "authExpiry" : "2023-07-19T14:15:40Z",
    "shouldCreateCustomer": true,
    "merchantId": "stock",
    "issuingPsp": "YES_BIZ",
    "customerId": "abcde12345",
  }
}
```



### Step 4 Create CallbackHandler


During its lifecycle, SDK emits multiple events to communicate about the transaction status. All of these events are received by an instance of `HyperPaymentsCallbackAdapter`.

This callback handler is passed as the second argument to the initiate API call.



#### Code Snippets: -

#### Swift Code Snippet:

```swift
func hyperCallbackHandler(response : (Optional<Dictionary<String, Any>>)) {
        if let data = response, let event = data["event"] as? String {
          // block:start:handle-sdk-response

            // block:start:show-loader
            if (event == "show_loader") {
                // Show some loader here
            } 
            // block:end:show-loader

            // block:start:hide-loader
            else if (event == "hide_loader") {
                // Hide Loader
            }
            // block:end:hide-loader
            
            // block:start:initiate-result
            else if (event == "initiate_result") {
                // Get the response
                HelperShared.showResponseOnResponseLabel(sself.view, false, response)
            }
            // block:end:initiate-result

            // block:start:process-result
            else if (event == "process_result") {
                // Get the response
                HelperShared.showResponseOnResponseLabel(sself.view, false, response)
            }
            // block:end:process-result

            // block:start:log-stream
            else if (event == "log_stream") {
                // Get the response
                NSLog("Log stream response :- %@", HelperShared.JSONToString(data: response as Any))
            }
            // block:end:log-stream

            // block:start:session-expiry
            else if (event == "session_expiry") {
                // Handle Session Expiry
            }
            // block:start:session-expiry

          // block:start:handle-sdk-response
        }

    }
```

#### Objective-C Code Snippet:

```objective-c
self.hyperCallbackHandler = ^(NSDictionary<NSString *,id> * _Nullable response) {
        NSDictionary *data = response;
        NSString *event = data[@"event"];

        // block:start:show-loader
        if ([event isEqualToString:@"show_loader"]) {
            // Show some loader here
        }
        // block:end:show-loader

        // block:start:hide-loader
        else if ([event isEqualToString:@"hide_loader"]) {
            // Hide Loader
        }
        // block:end:hide-loader

        // block:start:initiate-result
        else if ([event isEqualToString:@"initiate_result"]) {
            // Get the response
            NSDictionary *innerPayload = data[@"payload"]
        }
        // block:end:initiate-result

        // block:start:process-result
        else if ([event isEqualToString:@"process_result"]) {
            // Get the response
            NSDictionary *innerPayload = data[@"payload"]
        }
        // block:end:process-result

        // block:start:log-stream
        else if ([event isEqualToString:@"log_stream"]) {
            NSString *dataString = [[NSString alloc] initWithData:data
                                             encoding:NSUTF8StringEncoding];
            NSLog(@"Log stream response :- %@", dataString);
        }
        // block:end:log-stream

        // block:start:session-expiry
        else if ([event isEqualToString:@"session_expiry"]) {
            // Handle Session Expiry
        }
        // block:end:session-expiry
    };
```



### Step 5 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: -

#### Swift Code Snippet:

```swift
hyperInstance.initiate(
            self,
            payload: createInitiatePayload(),
            callback: hyperCallbackHandler
        )
```

#### Objective-C Code Snippet:

```objective-c
NSDictionary *initPayload = [self createInitiatePayload];
    [self.hyperInstance initiate:self payload:initPayload callback:self.hyperCallbackHandler];
```


---

## Complete Code Reference

The following code files are referenced in the steps above:

### ViewController.m

```
// Importing Hyper SDK
// block:start:import-hyper-sdk
#import <HyperSDK/HyperSDK.h>
// block:end:import-hyper-sdk

@interface ViewController ()

// Declaring HyperServices property
@property (nonatomic, strong) HyperServices *hyperInstance;
@property (nonatomic, copy) HyperSDKCallback hyperCallbackHandler;

@end

@implementation ViewController


// Creating initiate payload JSON object
// block:start:create-initiate-payload
- (NSDictionary *)createInitiatePayload {

    NSDictionary *innerPayload = @{
        @"action": @"initiate",
        @"merchantKeyId": @"<MERCHANT_KEY_ID>",
        @"clientId": @"<CLIENT_ID>",
        @"environment": @"production",
        @"issuingPsp": @"YES_BIZ",
        @"signature": @"....",
        @"signaturePayload": signaturePayload
    };

    // block:start:generatingRequestId
    NSUUID *uuid = [NSUUID UUID];
    NSString *requestId = [uuid UUIDString];
    // block:end:generatingRequestId

    NSDictionary *sdkPayload = @{
        @"requestId": requestId,
        @"service": @"in.juspay.hyperapi",
        @"payload": innerPayload
    };

    NSDictionary *ignaturePayload = @{
        @"merchant_id": @"<MERCHANT_ID>",
        @"customer_id": @"<CUSTOMER_ID>",
        @"timestamp": @"<timestamp>"
    };

    return sdkPayload;
}
// block:end:create-initiate-payload


// Creating initiate payload JSON object (clientAuthToken)
// block:start:create-initiate-payload-clientAuthToken
- (NSDictionary *)createInitiatePayload {

    NSDictionary *innerPayload = @{
        @"action": @"initiate",
        @"clientId": @"<CLIENT_ID>",
        @"environment": @"production",
        @"issuingPsp": @"YES_BIZ",
        @"clientAuthToken": @"token",
    };

    // block:start:generatingRequestId
    NSUUID *uuid = [NSUUID UUID];
    NSString *requestId = [uuid UUIDString];
    // block:end:generatingRequestId

    NSDictionary *sdkPayload = @{
        @"requestId": requestId,
        @"service": @"in.juspay.hyperapi",
        @"payload": innerPayload
    };

    return sdkPayload;
}
// block:end:create-initiate-payload-clientAuthToken

- (void)viewDidLoad {

    [super viewDidLoad];

    //block:start:create-hyper-services-instance
    self.hyperInstance = [[HyperServices alloc] init];
    //block:end:create-hyper-services-instance

    //block:start:create-hyper-callback
    self.hyperCallbackHandler = ^(NSDictionary<NSString *,id> * _Nullable response) {
        NSDictionary *data = response;
        NSString *event = data[@"event"];

        // block:start:show-loader
        if ([event isEqualToString:@"show_loader"]) {
            // Show some loader here
        }
        // block:end:show-loader

        // block:start:hide-loader
        else if ([event isEqualToString:@"hide_loader"]) {
            // Hide Loader
        }
        // block:end:hide-loader

        // block:start:initiate-result
        else if ([event isEqualToString:@"initiate_result"]) {
            // Get the response
            NSDictionary *innerPayload = data[@"payload"]
        }
        // block:end:initiate-result

        // block:start:process-result
        else if ([event isEqualToString:@"process_result"]) {
            // Get the response
            NSDictionary *innerPayload = data[@"payload"]
        }
        // block:end:process-result

        // block:start:log-stream
        else if ([event isEqualToString:@"log_stream"]) {
            NSString *dataString = [[NSString alloc] initWithData:data
                                             encoding:NSUTF8StringEncoding];
            NSLog(@"Log stream response :- %@", dataString);
        }
        // block:end:log-stream

        // block:start:session-expiry
        else if ([event isEqualToString:@"session_expiry"]) {
            // Handle Session Expiry
        }
        // block:end:session-expiry
    };
    //block:end:create-hyper-callback

}


- (IBAction)initiateHyperSDK:(id)sender {
    // block:start:initiate-sdk
    NSDictionary *initPayload = [self createInitiatePayload];
    [self.hyperInstance initiate:self payload:initPayload callback:self.hyperCallbackHandler];
    // block:end:initiate-sdk
}
- (IBAction)callProcess:(id)sender {
    // block:start:process-sdk
    NSDictionary *innerPayload = @{
        @"action": @"upiCheckPermission"
    };

    NSDictionary *processPayload = @{
        @"requestId": NSUUID.UUID.UUIDString,
        @"service": @"in.juspay.hyperpay",
        @"payload": innerPayload
    };

    if([self.hyperInstance isInitialised]) {
        [self.hyperInstance process:processPayload];
    }
    // block:end:process-sdk
}

// block:start:terminate
- (IBAction)callTerminate:(id)sender {
    [self.hyperInstance terminate]
}
// block:end:terminate

@end
```

### ViewController.swift

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

### ClientAuth.txt

```
// block:start:clientAuthTokenPayload

{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    ...
    "clientAuthToken": "<clientAuthToken>"
    ...
  }
}

// block:end:clientAuthTokenPayload

// block:start:initiate-payloadClientAuth

{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "initiate",
    "clientId": "<Client Id>",
    "environment": "sandbox",
    "merchantLoader": false,
    "clientAuthToken": "<clientAuthToken>",
    "authExpiry" : "2023-07-19T14:15:40Z",
    "shouldCreateCustomer": true,
    "merchantId": "stock",
    "issuingPsp": "YES_BIZ",
    "customerId": "abcde12345",
  }
}

// block:end:initiate-payloadClientAuth


// block:start:initiate-payloadClientAuthResp

{
  "requestId": "<request id passed>",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "initiate",
    "status": "SUCCESS/FAILURE",
  },
  "error": false,
  "errorMessage": "",
  "errorCode": "",
  "event": "process_result"
}

// block:end:initiate-payloadClientAuthResp


// block:start:getSessionTokenClientAuthReq

{
  "requestId": "f7443c1d-9acb-4b3d-9ae5-0e3c33dfcf5b",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "upiGetSessionToken",
    "clientAuthToken": "<clientAuthToken>",
    "authExpiry" : "2023-07-19T14:15:40Z",
    "merchantId": "stock",
    "customerId": "abcde12345",
      }
}


// block:end:getSessionTokenClientAuthReq


// block:start:getSessionTokenClientAuthResp

{
  "requestId": "f7443c1d-9acb-4b3d-9ae5-0e3c33dfcf5b",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "upiGetSessionToken",
    "status": "LINKED",
    "isDeviceBound": "true",
    "isDeviceActivated": "true",
    "vpaAccounts": [{
      "account": {
        "bankCode": "11111",
        "bankName": "ABCD",
        "maskedAccountNumber": "XXXX203891",
        "mpinLength": "6",
        "mpinSet": "true",
        "referenceId": "A0760cb548bb4dda9d32e3030863dd5",
        "isInitialTopUpDone": "true",   //In case of UPI lite,
        "isPrimary": "true",
        "otpLength": "6",
        "atmPinLength": "6"
      },
      "vpa": "abc@xyz",
    }],
    "prefix": "XYZ"
  },
  "error": false,
  "errorMessage": "",
  "errorCode": "",
  "event": "process_result"
}

// block:end:getSessionTokenClientAuthResp


// block:start:onboardingAndPayClientAuthReq

{
  "requestId": "79fc93aa-2d98-49c9-bbb1-2beaafd4f3b6",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "onboardingAndPay",
    "customerMobileNumber" : "9876879867",
    "clientAuthToken": "<clientAuthToken>",
    "paymentMethod": "UPI_INAPP",
    "authExpiry" : "2023-07-19T14:15:40Z",
    "merchantId": "stock",
    "customerId": "abcde12345",
    "amount": "2.00",
    "accountRefId": "<Account reference Id>",
    "showStatusScreen" : "true/false"
    "orderId": "ABC1234567890"
     }
}


// block:end:onboardingAndPayClientAuthReq


// block:start:onboardingAndPayClientAuthResp

{
  "requestId": "79fc93aa-2d98-49c9-bbb1-2beaafd4f3b6",
  "service": "in.juspay.hyperupi",
  "payload": {
    "action": "onboardingAndPay",
    "txnUuid": "mozoghi9Z6PsanCGWK1V",
    "selectedAccount": {
      "vpa": "abc@xyz",
      "account": {
        "ifsc": "ABCD0000011",
        "mpinSet": "true",
        "bankCode": "123456",
        "referenceId": "A621542c281c4a20b8faf0ee1cb75d",
        "maskedAccountNumber": "XXXXXXX20000",
        "isPrimary": "true",
        "bankName": "Mybank"
      }
    },
    "orderId": "ABCDE12345",
    "status": "SUCCESS"
  },
  "error": false,
  "errorMessage": "",
  "errorCode": "",
  "event": "process_result"
}

// block:end:onboardingAndPayClientAuthResp

// block:start:managementClientAuthReq

{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "management",
    "merchantId": "stock",
    "customerId": "abcde12345",
    "clientAuthToken": "<clientAuthToken>",
    "authExpiry" : "2023-07-19T14:15:40Z",
    "shouldExitOnDeregister": "true"
  }
}

// block:end:managementClientAuthReq


// block:start:managementClienttAuthResp

{
  "requestId": "19d7fa5f-24b9-4864-a659-147ca57918b4",
  "service": "in.juspay.hyperupi",
  "payload": {
    "action": "management",
    "status": "SUCCESS"
  },
  "error": false,
  "errorMessage": "",
  "errorCode": "",
  "event": "process_result"
}

// block:end:managementClientAuthResp

// block:start:upiUiScanPayClientAuthReq

{
  "requestId": "79fc93aa-2d98-49c9-bbb1-2beaafd4f3b6",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "onboardingAndPay",
    "merchantid": "stock",
    "customerid": "abcde12345",
    "clientAuthToken": "<clientAuthToken>"
    "authExpiry" : "2023-07-19T14:15:40Z",
    "showStatusScreen" : "true/false"
     }
}


// block:end:upiUiScanPayClientAuthReq

/ block:start:upiUiScanPayClientAuthResp

{
  "service": "in.juspay.hyperapi",
  "requestId": "d0c1d85e-c954-4758-9701-bfa69dd33239",
  "payload": {
    "status": "Successful",
    "gatewayTransactionId": "AXB4e3459e929a6464d8a37c47e9e52b7c1",
    "gatewayResponseMessage": "Your transaction is successful",
    "gatewayResponseCode": "00",
    "actionPerformed": "Pay",
    "action": "upiUiScanPay",
    "accountReferenceId": "Aa6c1763d28a406e8c2d7fbe23fcc1",
    "payeeName": "ABC",
    "amount": "20.00",
    "transactionTimestamp": "2022-01-28T14:44:51+05:30"
  },
  "event": "process_result",
  "errorMessage": "",
  "errorCode": "",
  "error": false
}

// block:end:upiUiScanPayClientAuthResp

// block:start:payClientAuthReq

{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "upiTxn",
    "merchantId": "stock",
    "customerId": "abcde12345",
    "clientAuthToken": "<clientAuthToken>",
    "authExpiry" : "2023-07-19T14:15:40Z",
    "accountRefId" : "ABC123456789",
    "amount" : "2.00",
    "gatewayReferenceId": "ABC123",
    "orderId" " "ABC123456789"
  }
}

// block:end:payClientAuthReq

// block:start:payClientAuthResp

{
  "requestId": "79fc93aa-2d98-49c9-bbb1-2beaafd4f3b6",
  "service": "in.juspay.hyperupi",
  "payload": {
    "action": "upiTxn",
    "txnUuid": "moz3hjuAtiiQriCVFBn",
    "selectedAccount": {
      "vpa": "abc@xyz",
      "account": {
        "type": "SAVINGS",
        "referenceId": "A0387f9jkl54476183527acfaf9491",
        "otpLength": "6",
        "name": "XXXXat",
        "mpinSet": "true",
        "mpinLength": "6",
        "maskedAccountNumber": "XXXXXXX20000",
        "isPrimary": "true",
        "ifsc": "AAAA1236543",
        "branchName": "",
        "bankName": "MYPSP",
        "bankCode": "500001",
        "bankAccountUniqueId": "082eedaa58700e492179e97841584HJ8d39a4cff9275ef8ee9bc59f9186d3d68",
        "atmPinLength": "4"
      }
    },
    "status": "SUCCESS"
    "orderId": "ABC1234567890"
  },
  "error": false,
  "errorMessage": "",
  "errorCode": "",
  "event": "process_result"
}

// block:end:payClientAuthResp


// block:start:onboardingAndCreateMandate-ClientAuthReq

{
  "requestId": "79fc93aa-2d98-49c9-bbb1-2beaafd4f3b6",
  "service": "in.juspay.hyperapi",
  "payload": {
   "action": "onboardingAndPay",
   "shouldCreateMandate": true,
   "merchant_id": "stock",
   "customer_id": "abcde12345",
   "order_id": "ABC1234567890",
   "clientAuthToken": "<clientAuthToken>",
   "authExpiry" : "2023-07-19T14:15:40Z",
   "accountRefId" : "ABC123456789",
   "amount": "2.00",
   "gatewayReferenceId": "ABC123",
   "metadata.<issuing_psp>:mandate_name": "metadata.YES_BIZ:ABC",
   "options.create_mandate": "REQUIRED",
   "mandate.max_amount": "2000.00",
   "mandate.amount_rule": "FIXED",
   "mandate.frequency": "MONTHLY",
   "mandate.start_date": "166674893389237",
   "mandate.end_date": "16667389373820323",
   "mandate.block_funds" : "true",
   "mandate.rule_type" : "ON/BEFORE/AFTER",
   "mandate.rule_value" : "Recurrence Rule for Mandate. It is not required for ONETIME, DAILY and ASPRESENTED recurrencePattern.",
   "payType" : "P2P_PAY"
  }
} 

// block:end:onboardingAndCreateMandate-ClientAuthReq

// block:start:onboardingAndCreateMandate-ClientAuthResp

{
  "requestId": "79fc93aa-2d98-49c9-bbb1-2beaafd4f3b6",
  "service": "in.juspay.hyperupi",
  "payload": {
    "action": "onboardingAndPay",
    "status": "SUCCESS",
    "mandate": {
    "amount": "10.00",
    "amountRule": "EXACT",
    "blockFund": "false",
    "expiry": "2022-01-02T14:17:06+05:30",
    "gatewayMandateId": "YJPMe5c9711f1ede1f5524e2fadb48003aa0",
    "gatewayReferenceId": "806115044725",
      "gatewayResponseCode": "00",
      "gatewayResponseMessage": "Your transaction is successful",
      "gatewayResponseStatus": "SUCCESS",
      "initiatedBy": "PAYER",
      "mandateName": "Test Mandate",
      "mandateTimestamp": "2021-12-30T14:17:06+05:30",
      "merchantCustomerId": "DEMO-1234",
      "merchantRequestId": "eulb1a4418b4ac",
      "orgMandateId": "BJJMe5c9711f1ede1f5524e2f92648y03aa0",
      "payeeMcc": "4924",
      "payeeName": "GROWW",
      "payeeVpa": "growwuat@ypay",
      "payerName": "customer1",
      "payerRevocable": "true",
      "payerVpa": "customer1@ypay",
      "recurrencePattern": "WEEKLY",
      "recurrenceRule": "BEFORE",
      "recurrenceValue": "2",
      "refUrl": "https://www.google.com",
      "remarks": "Sample Remarks",
      "role": "PAYER",
      "shareToPayee": "true",
      "transactionType": "UPI_MANDATE",
      "umn": "uniqueMandateNumber@ypay",
      "validityEnd": "2022/09/20",
      "validityStart": "2022/01/20"
    }
  },
  "error": false,
  "errorMessage": "",
  "errorCode": "",
  "event": "process_result"
}

// block:end:onboardingAndCreateMandate-ClientAuthResp

// block:start:createMandateClientAuthReq

{
  "requestId": "79fc93aa-2d98-49c9-bbb1-2beaafd4f3b6",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "upiTxn",
    "shouldCreateMandate": true,
    "merchant_id": "stock",
    "customer_id": "abcde12345",
    "orderId ": "ABC123456789",
    "accountRefId" : "<Account reference taken from session>",
    "timestamp": "1668389349848",
    "amount": "200.00",
    "gatewayReferenceId": "ABC123",
    "order_id": "ABC1234567890",
    "clientAuthToken": "<clientAuthToken>",
    "authExpiry" : "2023-07-19T14:15:40Z",
    "accountRefId" : "ABC123456789",
    "amount": "2.00",
    "metadata.<issuing_psp>:mandate_name": "metadata.YES_BIZ:ABC",
    "options.create_mandate": "REQUIRED",
    "mandate.max_amount": "2000.00",
    "mandate.amount_rule": "FIXED",
    "mandate.frequency": "MONTHLY",
    "mandate.start_date": "166674893389237",
    "mandate.end_date": "16667389373820323",
    "mandate.block_funds" : "true",
    "mandate.rule_type" : "ON/BEFORE/AFTER",
    "mandate.rule_value" : "Recurrence Rule for Mandate. It is not required for ONETIME, DAILY and ASPRESENTED recurrencePattern." 
  
  }
}

// block:end:createMandateClientAuthReq

// block:start:createMandateClientAuthResp

{
  "requestId": "79fc93aa-2d98-49c9-bbb1-2beaafd4f3b6",
  "service": "in.juspay.hyperupi",
  "payload": {
    "action": "upiTxn",
    "status": "SUCCESS",
    "mandate": {
      "amount": "10.00",
      "amountRule": "EXACT",
      "blockFund": "false",
      "expiry": "2022-01-02T14:17:06+05:30",
      "gatewayMandateId": "YJPMe5c9711f1ede1f5524e2fadb48003aa0",
      "gatewayReferenceId": "806115044725",
      "gatewayResponseCode": "00",
      "gatewayResponseMessage": "Your transaction is successful",
      "gatewayResponseStatus": "SUCCESS",
      "initiatedBy": "PAYER",
      "mandateName": "Test Mandate",
      "mandateTimestamp": "2021-12-30T14:17:06+05:30",
      "merchantCustomerId": "DEMO-1234",
      "merchantRequestId": "eulb1a4418b4ac",
      "orgMandateId": "BJJMe5c9711f1ede1f5524e2f92648y03aa0",
      "payeeMcc": "4924",
      "payeeName": "GROWW",
      "payeeVpa": "growwuat@ypay",
      "payerName": "customer1",
      "payerRevocable": "true",
      "payerVpa": "customer1@ypay",
      "recurrencePattern": "WEEKLY",
      "recurrenceRule": "BEFORE",
      "recurrenceValue": "2",
      "refUrl": "https://www.google.com",
      "remarks": "Sample Remarks",
      "role": "PAYER",
      "shareToPayee": "true",
      "transactionType": "UPI_MANDATE",
      "umn": "uniqueMandateNumber@ypay",
      "validityEnd": "2022/09/20",
      "validityStart": "2022/01/20"
    }
  },
  "error": false,
  "errorMessage": "",
  "errorCode": "",
  "event": "process_result"
}

// block:end:createMandateClientAuthResp
```

### InitiatePayload.txt

```
// block:start:initiate-payload

{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "initiate",
    "merchantKeyId": "<Merchant Key Id>",
    "clientId": "<Client Id>",
    "merchantLoader": false,
    "signature": "<Generated signature for signature payload>",
    "signaturePayload": "<Stringified signature payload>",
    "environment": "sandbox",
    "upiEnvironment": "sandbox"
    "issuingPsp": "YES_BIZ",
    "shouldCreateCustomer": true,
    "logLevel": 1
  }
}

"signaturePayload": {
  "merchant_id": "stock",
  "customer_id": "abcde12345",
  "timestamp": "1668389349848"
}

// block:end:initiate-payload

// block:start:initiate-response

{
  "requestId": "<request id passed>",
  "service": "in.juspay.hyperapi",
  "payload": {
    "action": "initiate",
    "status": "SUCCESS/FAILURE",
  },
  "error": false,
  "errorMessage": "",
  "errorCode": "",
  "event": "process_result"
}

// block:end:initiate-response

// block:start:session-expiry-clientAuthToken

{
  "requestId" : "1234567890",
  "service" : "in.juspay.hyperapi",
  "payload" : {
    "action" : "updateAuth",
    "clientAuthToken": "<clientAuthToken>",
    "authExpiry" : "2021-07-19T07:20:53.318Z"
  }
}

// block:end:session-expiry-clientAuthToken

// block:start:session-expiry-signature

{
  "requestId" : "1234567890",
  "service" : "in.juspay.hyperapi",
  "payload" : {
    "action" : "updateAuth",
    "signature": "<Generated signature for signature payload>",
    "signaturePayload": "<Stringified signature payload>",
    "merchantKeyId" : "1234",
    "authExpiry" : "2021-07-19T07:20:53.318Z"
  }
}

"signaturePayload": {
  "merchant_id": "stock",
  "customer_id": "abcde12345",
  "timestamp": "1668389349848"
}

// block:end:session-expiry-signature

// block:start:signaturePayload

{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    ...
    "merchantKeyId": "<Merchant Key Id>",
    "signature": "<Generated signature for signature payload>",
    "signaturePayload": "<Stringified signature payload>",
    ...
  }
}

"signaturePayload": {
  "merchant_id": "stock",
  "customer_id": "abcde12345",
  "timestamp": "1668389349848"
}

// block:end:signaturePayload

// block:start:clientAuthTokenPayload

{
  "requestId": "8cbc3fad-8b3f-40c0-ae93-2d7e75a8624a",
  "service": "in.juspay.hyperapi",
  "payload": {
    ...
    "clientAuthToken": "<clientAuthToken>"
    ...
  }
}

// block:end:clientAuthTokenPayload
```


---

## See Also

- [Adding Frameworks](https://juspay.io/in/docs/upi-plugin-sdk/ios/getting-the-sdk/adding-frameworks)
- [Process](https://juspay.io/in/docs/upi-plugin-sdk/ios/interaction-with-sdk/process)
