To serve dynamically changing requirements for the payments ecosystem HyperSDK uses a JS engine to improve user experience and enable faster iterations.
Initiate API starts up the js engine and enables it to improve the performance and experience of the next SDK API calls.

Android

Input

  • JSON object which contains base payload that will remain static for one SDK instance.
  • HyperPaymentsCallbackAdapter is an interface method to handle callbacks/outputs from sdk. HyperSDK uses single point of communication with continuous events triggered during a payments lifecycle.

Integration Sample

hyperInstance.initiate(initiationPayload, new HyperPaymentsCallbackAdapter() {
   @Override
   public void onEvent(JSONObject data, JuspayResponseHandler handler) {
       try {
         String event = data.getString("event");
         if (event.equals("show_loader")) {
           // Show some loader here
         } else if (event.equals("hide_loader")) {
           // Hide Loader
         } else if (event.equals("initiate_result")) {
           // Get the response
           JSONObject response = data.optJSONObject("payload");
         } else if (event.equals("process_result")) {
           // Get the response
           JSONObject response = data.optJSONObject("payload");
           //Merchant handling
         }
       } catch (Exception e) {
         // merchant code...
       }  
    }
});

iOS

Input

  • View Controller ref which acts as a starting point for any SDK UI calls.
  • JSON object which contains base parameters that will remain static for one SDK instance.
  • HyperPaymentsCallback is an interface method to handle callbacks/outputs from sdk.

Integration Sample

self.hyperInstance.initiate(self, initiationPayload, callback: { [unowned self] (response) in
     if let data = response {
         let event = data["event"] as? String ?? ""
         if event == "show_loader" {
           // Show some loader here
         } else if event == "hide_loader" {
           // Hide Loader
         } else if event == "initiate_result" {
           // Get the payload
           let payload = response?["payload"]
         } else if event == "process_result" {
           // Get the payload
           let payload = response?["payload"]
           //Merchant handling
         }
     } else {
       //Error handling
     }
})
self.hyperInstance.initiate(self, initiationPayload, callback: { [unowned self] (response) in
     if let data = response {
         let event = data["event"] as? String ?? ""
         if event == "show_loader" {
           // Show some loader here
         } else if event == "hide_loader" {
           // Hide Loader
         } else if event == "initiate_result" {
           // Get the payload
           let payload = response?["payload"]
         } else if event == "process_result" {
           // Get the payload
           let payload = response?["payload"]
           //Merchant handling
         }
     } else {
       //Error handling
     }
})

What’s Next