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.
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
| Method | Helper class | Returns | Typical trigger |
|---|---|---|---|
getTopBannerDetails | CHEGNetworkCallHelper | Banner creatives for a placement | Home screen load |
getTopStoreDetails | CHEGNetworkCallHelper | Top stores with logos and discounts | Every app launch |
getChegCashBackPoints | CHEGNetworkCallHelper | The user's points balance and a deep link | Rendering a coin badge |
getScratchCardDetails | CHEGNetworkCallHelper | A scratch card deep link and banner | After a transaction completes |
trackLink | CheggoutUtils | Nothing — fires a tracking beacon | Banner or store displayed |
registerEvent | CHEGNetworkCallHelper | Not 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
| Parameter | Type | Required | Description |
|---|---|---|---|
virtaulId | String | Yes, except pre-login | The user's virtual ID. Mandatory in every context except a PreLogin placement. |
placementId | String | Yes | Defines the banner position within Cheggout, for example "01". Placements are configured by Cheggout for your channel. |
languageCode | String | Yes | 2-character ISO language code, for example "EN". |
securityKey | String | No | Pass an empty string. |
additionalParams | String | No | A JSON string of extra targeting parameters. |
| callback | CHEGTopBannerCallBack | Yes | Receives the JSON response. See Callbacks. |
virtaulIdThe 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"
}
]
}
}
| Field | Type | Meaning |
|---|---|---|
bannerLink | string | URL of the creative image to display. Documented with a maximum length of 500 characters. |
href | string | Deep-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. |
bankLink | string | Documented 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. |
bankBanner | boolean | Present in the response. TBD No semantics are documented, and its relationship to bankLink is not documented either — do not infer one from the other. |
duration | integer | Auto-scroll duration in seconds for a rotating carousel. |
trackLink, trackLinkExt, clickLink | string | Additional tracking strings. |
brandDescription | string | Short 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
| Parameter | Type | Required | Description |
|---|---|---|---|
virtualId | String | Yes, except pre-login | The user's virtual ID. |
placementId | String | Yes | The store placement, for example "00". |
languageCode | String | Yes | 2-character ISO code. |
securityToken | String | No | Pass an empty string. |
additionalParams | String | No | JSON string of extra parameters. |
| callback | CHEGTopOfferCallBack | Yes | Receives 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
| Parameter | Type | Required | Description |
|---|---|---|---|
virtualId | String | Yes | The user's virtual ID. |
sessionId | String | Yes | The active session ID for this user. |
| callback | CHEGCashBackCallBack | Yes | Receives the JSON response. |
Response
{ "cashbackPoints": "100", "deepLink": "deeplinkString" }
Note that cashbackPoints is a string, not a number. Parse defensively.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
triggerEventType | String | Yes | A predefined campaign or trigger code, for example UPI, WITHINBANK, IMPS, RTGS. Codes are configured for your channel. |
amount | Double | Yes | Transaction amount to 2 decimal places. |
extTransactionId | String | Yes | Unique alphanumeric transaction identifier, maximum 256 characters. Acts as the idempotency key. |
dateandtime | String | Yes | Transaction timestamp in the format DDMMYYYYHHMMSS. |
virtualId | String | Yes | The user's virtual ID. |
sessionId | String | Yes | Pass the literal " " — a single space — as documented. See the caution below. |
subTriggerEventType | String | No | Optional secondary trigger classification. |
merchantVPA | String | No | Required only for UPI transactions. |
| callback | CHEGScratchCardCallBack | Yes | Receives 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 hereUnlike 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"
}
| Field | Meaning |
|---|---|
status | true when a card was issued. false is a normal "not eligible" outcome, not an error. |
banner | Image to show inline, for example on a transaction success screen. |
deepLink | Pass this into the launch payload's DeeplinkInfo to open the card inside the SDK. |
isPopup | Whether an interstitial should be presented. |
popupBanner, popupDeepLink | The creative and destination for that interstitial. |
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.
trackLink
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
| Parameter | Type | Required | Description |
|---|---|---|---|
href | String | Yes | The href field exactly as received from the banner or store response. Do not modify or truncate it. |
virtualId | String | Yes | The 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 { /* ... */ }
)
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
- Callbacks and notifications — the interfaces every method above takes.
- Advertisement module — placements, banners and stores end to end.
- Scratch cards on the SDK.