This API should be triggered for all operations required from the HyperSDK. This API can be triggered any number of times based on requirements or app flow structure.
It should not be called on an HyperSDK instance which has not been initiated. To verify if an instance is initiated, kindly refer to check SDK initiated section under code snippets

Android

Input

  • JSON object which contains defined payload required to complete the process operation.

Integration Sample

hyperInstance.process(processPayload);

Backpress control

Since HyperSDK is a fragment, we will need the back-press event from the current activity to trigger events required for hardware back press.
hyperServices.onBackPressed() should be called during activityโ€™s onBackPressed(). If the result is true, HyperSDK will consume the hardware back press.

@Override
public void onBackPressed() {
    boolean backPressHandled = hyperInstance.onBackPressed();
    if(!backPressHandled) {
        super.onBackPressed();
    }
}

Activity Result for UPI Intent switches

If the merchant wants to use UPI Intent transactions (or any other transaction which requires us to switch to a third-party app) through Juspay SDK, we will need the merchant to delegate the control to the android lifecycle event onActivityResult() so that we can correctly process the result given by that corresponding android intent. To do that, the following code snippet can be used:

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   // merchant code...
}

๐Ÿ“˜

NOTE

The above snippet can be ignored if the merchant is not overriding the onActivityResult method provided by android.

If super.onActivityResult is not accessible to the merchant, they can implement it using a similar method provided by HyperServices:

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
   hyperInstance.onActivityResult(requestCode, resultCode, data);
   // merchant code...
}

๐Ÿšง

Note

Merchants using ReactActivity must call the above code snippet, for the SDK to function as expected.

React Native

This API should be triggered for all operations required from Payments SDK.
The result of the process call is provided in the Hyper Event listener, discussed in Listen to events from hypersdk.

HyperSdkReact.process(JSON.stringify(processPayload));

In case the merchant wants to control backpress, they can call hyperServices.onBackPressed only when the UI is shown and Juspay can handle backpress. They can ignore the boolean response.

๐Ÿšง

NOTE

If the passed activity is terminated in back press (super.onBackPressed or activity.finish), in this case hyper.onBackPressed returns true, which will cause HyperSDK ui to be removed.

Handling Permission Results

Juspay SDK uses permissions in various flows (Example OTP Auto Read), we will need the merchant to delegate the control to the android lifecycle event onRequestPermissionsResult() so that we can correctly process the result given by that corresponding permission request. To do that, the following code snippet can be used:

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
	super.onRequestPermissionsResult(requestCode, permissions, grantResults);
 	// Merchant code
}

๐Ÿ“˜

Note

The above snippet can be ignored if the merchant is not overriding the onRequestPermissionsResult method provided by android.

If super.onRequestPermissionsResult is not accessible to the merchant, they can implement it using a similar method provided by HyperServices:

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
	hyperServices.onRequestPermissionsResult(requestCode, permissions, grantResults);
 	// Merchant code
}

๐Ÿšง

Note

Merchants using ReactActivity must call the above code snippet, for the SDK to function as expected.

iOS

Input

  • JSON object which contains defined payload required to complete the process operation.

Integration Sample

self.hyperInstance.process(processPayload)
[self.hyperInstance process:processPayload];

Declare URL Schemes for iOS UPI Apps

Add the following properties in the Appโ€™s Info.plist file to use canOpenURL to check available UPI Apps

<key>LSApplicationQueriesSchemes</key>
	<array>
		<string>credpay</string>
		<string>phonepe</string>
		<string>paytmmp</string>
		<string>tez</string>
		<string>paytm</string>
	</array>

Whatโ€™s Next