Integrating the SDK

Minimum Requirements

📘

Android

  • The minimum API level supported by the Juspay SDK is API level 21
  • Both Java and Kotlin are supported. The SDK provides not only provides Java interfaces but also easily interoperability options in Kotlin. Examples are provided for both Java and Kotlin

📘

iOS

The Juspay SDK supports iOS 11.0 and higher

  • Only simulators running iOS 11.0 or higher are supported
  • Certain APIs are not supported on simulators so using an iOS device is recommended
  • Both Swift and Objective-C are supported. The SDK provides not only provides Objective-C interfaces but also easily interoperability options in Swift. Examples are provided for both Objective-C and Swift

Adding the SDK

In order to use Payments Page, the very first step is to install Payment Page SDK into your application and add proper configurations.

The SDK depends on certain assets to function. These are available over the air and are supposed to be present while building the SDK.

1. Android

In Android, we have made a Gradle plugin which integrates seamlessly with the Android Gradle Plugin. Please follow the below steps to set up an android project with the SDK.

Note: Minimum supported Android Gradle Plugin version is 3.6.0. Please get in touch with your Juspay POC or the Support Team if you are on an older version.

Step 1 : Add a build dependency in the buildscript repository of your root build.gradle file.

buildscript {
    repositories {
        google()

        maven {
            url "https://maven.juspay.in/jp-build-packages/hypersdk-asset-download/releases/"
        }
    }
    
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'  // ← 3.6.0 is minimum version
        classpath 'in.juspay:hypersdk-asset-plugin:1.0.3'
    }
}

Step 2 : Add the following maven repository to the allprojects repository in the same root build.gradle file mentioned above. The maven URL specifies from where the SDK dependency should be downloaded.

allprojects {
    repositories {
        google()
        jcenter()

       //Other maven url
        maven {
          url "https://maven.juspay.in/jp-build-packages/hyper-sdk/"
        }
      //Other maven url
    }
}

Step 3 : Apply the plugin to the application module (not any library modules).

apply plugin: 'hypersdk-asset-plugin'
plugins {
    id 'hypersdk-asset-plugin'
}

Step 4 : Add the following compile dependency to your project to the module where SDK will be used usually added to app/build.gradle (Module: app). Please make sure you don’t accidentally add it to script dependencies.

dependencies {  
    //HyperSDK
    implementation 'in.juspay:hypersdk:2.1.7'
}

Step 5 : The MerchantConfig.txt contains a clientId which helps the SDK to download assets specific to your application.

Add the MerchantConfig.txt file in the same directory as the gradle file where SDK Step 3 was done. The content of the file should be as follows:

clientId = <clientId> shared by Juspay Team

Note: Once the above steps are completed, please ensure you do a gradle sync and clean build.


2. iOS

Currently, our iOS SDK is available as a cocoa pods dependency to streamline integration. Please follow the below steps to set up the iOS SDK.

Step 1 : In order to download and install the cocoa pods to your application, please add Hyper SDK pod to your pod file.

pod 'HyperSDK','2.1.17'

Step 2: Add the following post_install script in the pod file. This helps to download all the latest assets (while doing pod install) required for proper functioning of your payment page integration.

post_install do |installer|
 fuse_path = "./Pods/HyperSDK/Fuse.rb"
 clean_assets = false # Pass true to re-download all the assets
 if File.exist?(fuse_path)
   if system("ruby", fuse_path.to_s, clean_assets.to_s)
   end
 end
end

Step 3 : The MerchantConfig.txt contains a clientId which helps the SDK to download assets specific to your application.

Place this file inside the folder where the pod file is present. This file doesn't need to be added to the project. The content of the file should be as follows:

clientId = <clientId> shared by Juspay Team

Step 4 : Run the below line via a command line interface to setup and install the newly added pod in the iOS project folder.

pod install

👍

The Output of pod install should give below logs in addition to other logs.

[HyperSDK] Client ID - clientId shared by Juspay Team
[HyperSDK] Downloading assets...
[HyperSDK] XX file(s) downloaded/updated.
[HyperSDK] Adding the required URL Schemes & Queries Schemes in plist files
[HyperSDK] Plist file path: ./{Project Name}/Info.plist
[HyperSDK] Done.

In case there is an error "Unable to find a specification for HyperSDK" while doing pod install, local pod repo needs to be updated. You will need to run:

pod repo update

Importing HyperSDK

import HyperSDK
#import <HyperSDK/HyperSDK.h>

What’s Next