Getting the SDK
The following three options are provided for SDK setup:
Note that the React Native option is much more flexible in that the different modules used for payment orchestration can be updated dynamically.
Setting up on Android (click to open)
AndroidCurrently, SDK on Android is available as a Gradle dependency. We have made a Gradle plugin which will integrate seamlessly with the Android Gradle Plugin. Please follow these steps to set up an Android project with the SDK.
Adding PluginNOTE:
Minimum supported Android Gradle Plugin version is 3.6.0. Please skip these steps if you are on older version.
Step 1: Add a build dependency in 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: Apply the plugin to the application module (not any library modules)
apply plugin: 'hypersdk-asset-plugin'
Step 3: Add the
MerchantConfig.txt
file in the same directory as theapp/build.gradle
file. The content of the file should be as follows:clientId = <clientId shared by Juspay Team>
Adding SDK DependencyStep 4: Add the following maven repository URL to the top (root) build.gradle.
Please make sure that it has been added to the project dependency section.allprojects { repositories { google() jcenter() maven { url "https://maven.juspay.in/jp-build-packages/hyper-sdk/" } //Other maven url } }
Step 5: Add the following compile dependency to your project to the module where SDK will be used. This will usually be the app/build.gradle (Module: app). Please make sure you don’t accidentally add it to script dependencies.
dependencies { implementation 'in.juspay:hypersdk:2.0.2-rc.59' ... //other dependencies ... }
Setting up on iOS (click to open)
iOSCurrently, the iOS SDK is available as a CocoaPods dependency to streamline integration. Please follow the below steps to set up iOS SDK
Getting the SDK Using SDK DependencyStep 1 : Add the following line in your podfile.
pod 'HyperSDK','2.0.33'
Step 2 : Run the below line via a command line interface to set up and Install the newly added pod.
pod install
In case there is an error "Unable to find a specification for `HyperSDK" during the pod installation, the local pod repo needs to be updated. You will need to run:
pod repo update
Step 3 : Importing HyperSDK
import HyperSDK
#import <HyperSDK/HyperSDK.h>
Getting the SDK Using PluginStep 1: Add the following post_install script in the Podfile:
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 2: Place the
MerchantConfig.txt
file alongside the Podfile. The content of the file should be as follows:clientId = <clientId shared by Juspay Team>
Step 3: Use command:
pod install
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 (It should not be internalPP)
[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.
Step 4 : Importing HyperSDK
import HyperSDK
#import <HyperSDK/HyperSDK.h>
Setting up on React Native (click to open)
React NativeThe React Native module for HyperSDK enables payment orchestration via different dynamic modules. Note that some parts of module that depend heavily on native functionalities cannot be updated dynamically. Refer to hyper-sdk-react to check the package on npm registry.
Payments SDK has been structured so that it exposes a limited set of generic APIs which will accommodate the new structures of the constantly changing payments ecosystem. This enables the consumption of new features seamlessly and with very minimal changes.
Installationnpm install hyper-sdk-react
or
yarn add hyper-sdk-react
Adding SDK DependencyReact Native can be set up for SDK dependency with either Android or iOS as follows:
Android (click to open)
AndroidStep 1 : Add the following maven repository URL to the top (root) build.gradle.
Please make sure that it has been added to the project dependency section.allprojects { repositories { maven { url "https://maven.juspay.in/jp-build-packages/hyper-sdk/" } ... //other repositories ... } }
Step 2 : Add the following ext property in the build.gradle if you want to override the base SDK version present in the plugin (Compulsory for Payment Page SDK):
buildscript { ... ext { ... hyperSDKVersion = "2.0.2-rc.59" ... } ... }
Note: This version is just for explanatory purposes and may change in future. Contact the Juspay support team for the latest SDK version.
Step 3 : Add the following ext property in the build.gradle if you are using the Dynamic Assets Feature:
buildscript { .... ext { .... hyperSDKVersion = "2.0.3-rc.46" useDynamicAssets = true .... } .... }
Also, if you will be using Dynamic Assets, place the
MerchantConfig.txt
file alongside the root (top)build.gradle
file. The contents of the file should be as follows:clientId = <clientId shared by Juspay Team>
Exposed APIs
type HyperSdkReactType = { preFetch(data: string): void; createHyperServices(): void; initiate(data: string): void; process(data: string): void; terminate(): void; onBackPressed(): boolean; isNull(): boolean; isInitialised(): Promise<boolean>; }; const { HyperSdkReact } = NativeModules; export default HyperSdkReact as HyperSdkReactType;
Run this command to import HyperSDK:
import HyperSdkReact from 'hyper-sdk-react';
iOS wwiww(click to open)
iOSStep 1 : Run the following command inside the iOS folder of your React Native project:
pod install
Step 2 : Add the following property in
package.json
of your project before running pod install if you want to override the base SDK version present in the plugin (Compulsory for Payment Page SDK):{ "scripts": { .... }, "dependencies": { .... }, "devDependencies": { .... }, "hyperSdkIOSVersion": "2.0.33" }
Note: This version is just for explanatory purposes and may change in future. Contact the Juspay support team for the latest SDK version.
Step 3 : If you are using the Dynamic Assets feature, change the
hyperSdkIOSVersion
to2.0.78
(Again, this version may change in future. Contact the Juspay support team for the latest SDK version).Then add the following
post_install
script in the Podfile: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
Also, if you will be using Dynamic Assets, place the
MerchantConfig.txt
file alongside the Podfile. The contents of the file should be as follows:clientId = <clientId shared by Juspay Team>
Exposed APIs
type HyperSdkReactType = { preFetch(data: string): void; createHyperServices(): void; initiate(data: string): void; process(data: string): void; terminate(): void; onBackPressed(): boolean; isNull(): boolean; isInitialised(): Promise<boolean>; }; const { HyperSdkReact } = NativeModules; export default HyperSdkReact as HyperSdkReactType;
Run this command to import HyperSDK:
import HyperSdkReact from 'hyper-sdk-react';
Updated over 1 year ago