Prefetch(optional)
This is an optional call
Prefetch API gets the latest business logic and keeps the SDK experience uniform for all users.
This API can be triggered any number of times and only updates assets for critical requirements.
FAQ section has answers for most queries.
Input
- JSON object which contains payload as defined below.
Integration Sample
HyperServices.preFetch(getApplicationContext(), jsonPayload);
HyperServices.preFetch(getApplicationContext(), jsonPayload);
HyperServices.preFetch(jsonPayload)
[HyperServices preFetch:payload];
HyperSdkReact.preFetch(JSON.stringify(preFetchPayload));
Payload
- clientId is assigned by Juspay as a unique reference to static resources allocated to a merchant.
- service is the reference to Juspay product being consumed.
{
"service" : "in.juspay.hyperpay",
"payload" : {
"clientId" : "<Client Id>"
}
}
JSONObject preFetchPayload = new JSONObject();
try {
JSONObject innerPayload = new JSONObject();
String clientId = "<clientID>";
innerPayload.put("clientId", clientId);
preFetchPayload.put("payload", innerPayload);
preFetchPayload.put("service","in.juspay.hyperpay");
} catch (JSONException e) {
e.printStackTrace();
}
HyperServices.preFetch(this, preFetchPayload);
val preFetchPayload = JSONObject()
try {
val innerPayload = JSONObject()
val clientId = "<clientID>"
innerPayload.put("clientId", clientId)
preFetchPayload.put("payload", innerPayload)
preFetchPayload.put("service", "in.juspay.hyperpay")
} catch (e: JSONException) {
e.printStackTrace()
}
HyperServices.preFetch(this, preFetchPayload)
let payload = [
"service" : "in.juspay.hyperpay",
"payload" : [
"clientId" : "<clientID>"
]
] as [String: Any]
Hyper.preFetch(payload)
NSDictionary *payload = @{
@"service" : @"in.juspay.hyperpay",
@"payload" : @{
@"clientId" : @"<clientID>"
}
};
[Hyper preFetch:payload];
Where to Call Prefetch?
- Android: In the onCreate() method of your application's main activity
- iOS: In application:didFinishLaunchingWithOptions method of the application's AppDelegate class
- React
- Class Component architecture: In componentDidMount() method
- Function Component architecture: In useEffect() hook
Updated about 1 year ago