Skip to main content

Android SDK methods

Beyond launching the full shopping module, the SDK exposes a small set of data methods so you can render Cheggout content inside your own screens — a banner carousel on your home page, store icons in a rail, the user's points next to their balance.

Every method here follows the same shape: a static call on a helper class, a list of scalar parameters, and a callback object whose onResponse receives a JSON string that you parse. None of them render UI. They give you data; you draw it.

These are network calls

Each method makes an HTTP request. Call them off the main thread's critical path, cache where the data allows it, and always handle a null or empty responseString — the callbacks carry no separate error channel.

Method summary

MethodHelper classReturnsTypical trigger
getTopBannerDetailsCHEGNetworkCallHelperBanner creatives for a placementHome screen load
getTopStoreDetailsCHEGNetworkCallHelperTop stores with logos and discountsEvery app launch
getChegCashBackPointsCHEGNetworkCallHelperThe user's points balance and a deep linkRendering a coin badge
getScratchCardDetailsCHEGNetworkCallHelperA scratch card deep link and bannerAfter a transaction completes
trackLinkCheggoutUtilsNothing — fires a tracking beaconBanner or store displayed
registerEventCHEGNetworkCallHelperNot available

getTopBannerDetails

Fetches the banner creatives configured for a placement so you can render them in your own carousel.

CHEGNetworkCallHelper.Companion.getTopBannerDetails(
virtaulId,
placementId,
languageCode,
securityKey,
additionalParams,
object : CHEGTopBannerCallBack {
override fun onResponse(responseString: String) {
// Parse and render
}
}
)

Parameters

ParameterTypeRequiredDescription
virtaulIdStringYes, except pre-loginThe user's virtual ID. Mandatory in every context except a PreLogin placement.
placementIdStringYesDefines the banner position within Cheggout, for example "01". Placements are configured by Cheggout for your channel.
languageCodeStringYes2-character ISO language code, for example "EN".
securityKeyStringNoPass an empty string.
additionalParamsStringNoA JSON string of extra targeting parameters.
callbackCHEGTopBannerCallBackYesReceives the JSON response. See Callbacks.
The parameter is spelled virtaulId

The first parameter name is misspelled in the SDK. It is the virtual ID. Named-argument callers must use the SDK's spelling.

Example

CHEGNetworkCallHelper.Companion.getTopBannerDetails(
"pub_8f14e45fceea167a",
"01",
"EN",
"",
"",
object : CHEGTopBannerCallBack {
override fun onResponse(responseString: String) {
val banners = Gson().fromJson(responseString, BannerResponse::class.java)
renderCarousel(banners)
}
}
)

Response shape

{
"banners": {
"01": [
{
"bannerLink": "https://assets.example.com/creatives/REPLACE.jpg",
"trackLink": "<tracking string>",
"trackLinkExt": "<tracking string>",
"href": "<tracking and deep-link string>",
"bankBanner": false,
"duration": 10,
"bankLink": "",
"clickLink": "<tracking string>",
"brandDescription": "REPLACE"
}
]
}
}
FieldTypeMeaning
bannerLinkstringURL of the creative image to display. Documented with a maximum length of 500 characters.
hrefstringDeep-linking and impression tracking information. Documented with a maximum length of 1000 characters. Pass it to trackLink on display, and into the launch payload's DeeplinkInfo on click.
bankLinkstringDocumented values are 0 and 1. bankLink = 1 means the banner is the Bank's own and the app must not call the SDK — handle it yourself. TBD Samples also show an empty string; what an empty value means is not documented.
bankBannerbooleanPresent in the response. TBD No semantics are documented, and its relationship to bankLink is not documented either — do not infer one from the other.
durationintegerAuto-scroll duration in seconds for a rotating carousel.
trackLink, trackLinkExt, clickLinkstringAdditional tracking strings.
brandDescriptionstringShort brand copy to show alongside the creative.

The three-step contract is: fetch on home screen visit → fire the impression when displayed → launch the SDK with href in the payload when clicked. See Advertisement tracking.


getTopStoreDetails

Fetches the top stores for a placement — brand logos with their current discount, for a rail or grid on your own screen.

CHEGNetworkCallHelper.Companion.getTopStoreDetails(
virtualId,
placementId,
languageCode,
securityToken,
additionalParams,
object : CHEGTopOfferCallBack {
override fun onResponse(responseString: String?) {
// Parse and render
}
}
)

Parameters

ParameterTypeRequiredDescription
virtualIdStringYes, except pre-loginThe user's virtual ID.
placementIdStringYesThe store placement, for example "00".
languageCodeStringYes2-character ISO code.
securityTokenStringNoPass an empty string.
additionalParamsStringNoJSON string of extra parameters.
callbackCHEGTopOfferCallBackYesReceives the JSON response.

Response shape

[
{
"storeId": "REPLACE",
"title": "Example Retailer",
"href": "<tracking and deep-link string>",
"logo": "https://assets.example.com/logos/REPLACE.png",
"discountPercentage": "5",
"category": "Fashion"
}
]

Call this on each launch, and display stores with their names and discount details — the discount is the reason a user taps. When a store icon is clicked, open the SDK and pass that store's href in the payload's DeeplinkInfo.


getChegCashBackPoints

Returns the user's Cheggout points balance so you can show it in your own UI, next to a coin icon or in a rewards summary.

CHEGNetworkCallHelper.Companion.getChegCashBackPoints(
virtualId,
sessionId,
object : CHEGCashBackCallBack {
override fun onResponse(responseString: String?) {
// { "cashbackPoints": "100", "deepLink": "deeplinkString" }
}
}
)

Parameters

ParameterTypeRequiredDescription
virtualIdStringYesThe user's virtual ID.
sessionIdStringYesThe active session ID for this user.
callbackCHEGCashBackCallBackYesReceives the JSON response.

Response

{ "cashbackPoints": "100", "deepLink": "deeplinkString" }

Note that cashbackPoints is a string, not a number. Parse defensively.

You may not need this call at all

If you only want a tappable coin icon, you can skip the API entirely: place the icon in your app and open the deep link Cheggout provides. The SDK opens on the Cheggout page with the points already displayed. Use getChegCashBackPoints only when you want to render the balance yourself.

See Cashback badge.


getScratchCardDetails

Requests a scratch card for a completed transaction. This is the client-side issuance path; the server-to-server equivalent is GetScratchCardForBank.

CHEGNetworkCallHelper.Companion.getScratchCardDetails(
triggerEventType,
amount,
extTransactionId,
dateandtime,
virtualId,
" ", // sessionId — the documented literal, a single space
subTriggerEventType,
merchantVPA,
object : CHEGScratchCardCallBack {
override fun onResponse(responseString: String?) {
// handle deep-link
}
}
)

Parameters

ParameterTypeRequiredDescription
triggerEventTypeStringYesA predefined campaign or trigger code, for example UPI, WITHINBANK, IMPS, RTGS. Codes are configured for your channel.
amountDoubleYesTransaction amount to 2 decimal places.
extTransactionIdStringYesUnique alphanumeric transaction identifier, maximum 256 characters. Acts as the idempotency key.
dateandtimeStringYesTransaction timestamp in the format DDMMYYYYHHMMSS.
virtualIdStringYesThe user's virtual ID.
sessionIdStringYesPass the literal " " — a single space — as documented. See the caution below.
subTriggerEventTypeStringNoOptional secondary trigger classification.
merchantVPAStringNoRequired only for UPI transactions.
callbackCHEGScratchCardCallBackYesReceives the JSON response.

An additionalParams JSON string is also part of this contract, carrying optional country, state, district, city, pincode, storeId, ipaddress, lat, long, gender, age, modeType and isNewUser. All of its inner fields are optional and are used for targeting.

sessionId is not a real session here

Unlike every other method on this page, getScratchCardDetails does not take the user's session. The source material calls for "an empty string" and then writes it as " " — which is a single space, not an empty string. Pass the literal " " exactly as documented.

TBD Whether a truly empty string "" is also accepted is not documented. Confirm with Cheggout before changing it.

Response

{
"message": "Success",
"banner": "https://assets.example.com/creatives/REPLACE.jpg",
"status": true,
"deepLink": "https://click.cheggout.com?type=reward&scratchCardId=1",
"isPopup": true,
"popupBanner": "https://assets.example.com/creatives/REPLACE.jpg",
"popupDeepLink": "https://click.cheggout.com?type=reward&scratchCardId=5"
}
FieldMeaning
statustrue when a card was issued. false is a normal "not eligible" outcome, not an error.
bannerImage to show inline, for example on a transaction success screen.
deepLinkPass this into the launch payload's DeeplinkInfo to open the card inside the SDK.
isPopupWhether an interstitial should be presented.
popupBanner, popupDeepLinkThe creative and destination for that interstitial.
Prefer server-side issuance where you can

A client-initiated issuance path allows requests that are not tied to a verified transaction. If your backend can make the signed call instead, bind virtualId and extTransactionId to a verified order server-side and use GetScratchCardForBank. See Security best practices.


Fires the impression beacon for a banner or store you have displayed. It returns nothing and has no callback — call it and move on.

CheggoutUtils.Companion.trackLink(href, virtualId)

Parameters

ParameterTypeRequiredDescription
hrefStringYesThe href field exactly as received from the banner or store response. Do not modify or truncate it.
virtualIdStringYesThe user's virtual ID.

Call it whenever a banner is displayed — not when it is fetched. For a rotating carousel, that means once per creative as it becomes visible, not once for the whole response.

// In your carousel's page-change handler
override fun onPageSelected(position: Int) {
val banner = banners[position]
CheggoutUtils.Companion.trackLink(banner.href, virtualId)
}

The href value is a pseudo-XML tracking string carrying tags such as <click>, <track>, <clicktrack>, <browser>, <expiryduration>, <id> and <redirectURL>. The SDK parses it for you. Headless integrators must parse the tag they need and fire the URL with a plain GET.


registerEvent

Not available

This method is not currently usable. It is documented here so that you recognise it if you find it in older integration material or in the SDK's symbol list.

The historical specification, for reference only:

CHEGNetworkCallHelper.registerEvent(
virtualId,
eventType, // e.g. "register" or "referral"
subEventType, // for referral, the referral code
additionalParams, // JSON string, e.g. {"isNewUser":true}
object : CHEGregisterCampaignEventCallBack { /* ... */ }
)
No server implementation

Verification against the platform found no server implementation for the RegisterEvent endpoint this method calls. Do not design a registration or referral flow around it. Confirm availability with Cheggout before planning any work that depends on it. Tracked in Open items.

The same caveat applies to the ExitEvent endpoint. See Register and Exit events.

Next