Prefetch
HyperSDK uses a js engine to run critical business logic which enables seamless integrations and faster updates to the SDK.
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(), payload);
HyperServices.preFetch(payload)
[HyperServices preFetch:payload];
HyperServices.preFetch(getApplicationContext(), payload);
Payload
- clientId is assigned by Juspay as a unique reference to static resources allocated to a merchant.
- betaAssets enables switching between test and production resources. Allows having a server controlled logic like some customer-id as a designated tester to receive asset updates before being pushed to all customers. In case not passed defaults to production assets.
- service is the reference to Juspay product being consumed.
{
"service" : "in.juspay.hyperapi",
"payload" : {
"clientId" : "<Client Id>"
}
}
boolean useBetaAssets = true; // If you want to use beta assets
String clientId = "clientId"; // unique resource identifier
JSONObject payload = new JSONObject();
JSONObject innerPayload = new JSONObject();
try {
//Setting clientId as nested to ensure uniformity across payloads
innerPayload.put("clientId", clientId);
//Ensuring proper nesting
payload.put("payload", innerPayload);
//service acts as a product refrence
payload.put("service", "in.juspay.hyperapi");
} catch (JSONException e) {
e.printStackTrace();
}
HyperServices.preFetch(getApplicationContext(), payload);
let clientId = "clientId" //Unique resource identifier
//Setting clientId as nested to ensure uniformity across payloads
var innerPayload : [String:Any] = [:]
innerPayload["clientId"] = clientId
//Service acts as a product refrence
let payload = [
"payload" : innerPayload,
"service" : "in.juspay.hyperapi"
] as [String: Any]
HyperServices.preFetch(payload)
NSString *clientId = @"clientId"; //Unique resource identifier
//Setting clientId as nested to ensure uniformity across payloads
NSMutableDictionary *innerPayload = [NSMutableDictionary new];
innerPayload[@"clientId"] = clientId;
//Service acts as a product refrence
NSDictionary *payload = @{
@"payload" : innerPayload,
@"service" : @"in.juspay.hyperapi"
};
[HyperServices preFetch:payload];
Updated over 1 year ago