iOS SDK methods
The CheggoutApp instance exposes data methods so you can render Cheggout content inside your own
SwiftUI or UIKit screens rather than handing over the whole display. They return data through
trailing closures; none of them draw anything.
Each method makes an HTTP request. Results arrive on a background queue unless stated otherwise — hop to the main queue before touching UI. There is no separate error channel on these closures, so treat a nil or empty result as failure.
Method summary
| Method | Returns | Typical trigger |
|---|---|---|
getCheggoutTopBanners | Banner creatives for a placement | Home screen appears |
getCheggoutTopStores | Top stores with logos and discounts | Every app launch |
getCashbackPoints | The user's points balance and a deep link | Rendering a coin badge |
sendRewardCardRequest | A scratch card deep link and banner | After a transaction completes |
impression | Nothing — fires a tracking beacon | Banner or store displayed |
registerEvent | Not available | — |
getCheggoutTopBanners
Fetches banner creatives for a placement so you can render your own carousel.
CheggoutApp.getCheggoutTopBanners(
languageCode: "EN",
virtualId: "pub_8f14e45fceea167a",
placementId: "01",
additonalParams: "",
securityKey: ""
) { topBanners in
DispatchQueue.main.async {
self.render(topBanners)
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
languageCode | String | Yes | 2-character ISO language code, for example "EN". |
virtualId | String | Yes, except pre-login | The user's virtual ID. Mandatory except on a PreLogin placement. |
placementId | String | Yes | Defines the banner position within Cheggout, for example "01". Configured by Cheggout for your channel. |
additonalParams | String | No | A JSON string of extra targeting parameters. |
securityKey | String | No | Pass an empty string. |
| completion | closure | Yes | Receives the banner payload. |
additonalParamsThe label is misspelled in the SDK. Swift argument labels are part of the signature, so you must use the SDK's spelling.
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 impression 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. 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. |
brandDescription | string | Short brand copy to show with the creative. |
The contract is three steps: fetch on home screen visit → fire the impression when the creative is
displayed → launch the SDK with href in DeeplinkInfo on click.
getCheggoutTopStores
Fetches the top stores for a placement — logos, names and current discount.
CheggoutApp.getCheggoutTopStores(
languageCode: "EN",
virtualId: "pub_8f14e45fceea167a",
placementId: "00",
additionalParams: "",
securityKey: ""
)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
languageCode | String | Yes | 2-character ISO code. |
virtualId | String | Yes, except pre-login | The user's virtual ID. |
placementId | String | Yes | The store placement, for example "00". |
additionalParams | String | No | JSON string of extra parameters. |
securityKey | String | No | Pass an empty string. |
Note the label here is additionalParams — spelled correctly, unlike the banner method. The two are
not interchangeable.
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 each store with its name and discount details — the
discount is what earns the tap. On tap, open the SDK with that store's href in DeeplinkInfo.
getCashbackPoints
Returns the user's Cheggout points balance for display in your own UI.
CheggoutApp.getCashbackPoints(
virtualId: "pub_8f14e45fceea167a",
sessionId: "SessionID"
) { cashBackPoints in
DispatchQueue.main.async {
self.coinBadge.text = cashBackPoints.cashbackPoints
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
virtualId | String | Yes | The user's virtual ID. |
sessionId | String | Yes | The active session ID for this user. |
| completion | closure | Yes | Receives the points payload. |
Response
{ "cashbackPoints": "100", "deepLink": "deeplinkString" }
cashbackPoints is a string, not a number. Parse defensively.
For a simple tappable coin icon, skip the API: place the icon in your app and open the deep link
Cheggout provides. The SDK opens on the Cheggout page with the points already shown. Use
getCashbackPoints only when you want to render the number yourself.
sendRewardCardRequest
Requests a scratch card for a completed transaction. This is the iOS counterpart of Android's
getScratchCardDetails, and it is the client-side issuance path; the server-to-server
equivalent is GetScratchCardForBank.
CheggoutApp.sendRewardCardRequest(
triggerEventType: "UPI",
subTriggerEventType: "",
merchantVPA: "",
amount: 499.00,
extTransactionId: "PUB_TXN_20260731_000117",
dateandtime: "31072026141530",
virtualId: "pub_8f14e45fceea167a",
sessionId: " ",
additionalParams: ""
) { scratchCard in
DispatchQueue.main.async {
self.present(scratchCard)
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
triggerEventType | String | Yes | Predefined campaign or trigger code, for example UPI, WITHINBANK, IMPS, RTGS. |
subTriggerEventType | String | No | Optional secondary trigger classification. |
merchantVPA | String | No | Required only for UPI transactions. |
amount | Double | Yes | Transaction amount to 2 decimal places, in rupees. |
extTransactionId | String | Yes | Unique alphanumeric transaction identifier, maximum 256 characters. 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. |
additionalParams | String | No | JSON string with optional country, state, district, city, pincode, storeId, ipaddress, lat, long, gender, age, modeType, isNewUser. Used for targeting. |
| completion | closure | Yes | Receives the scratch card payload. |
sessionId is not a real session hereUnlike getCashbackPoints, this method 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 shown in the example above, because that is what is 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 display inline, for example on a payment success screen. |
deepLink | Pass into the launch payload's DeeplinkInfo to open the card inside the SDK. |
isPopup | Whether an interstitial should be presented. |
popupBanner, popupDeepLink | Creative and destination for that interstitial. |
A client-initiated issuance path allows requests that are not tied to a verified transaction. Where
your backend can make the signed call instead, bind virtualId and extTransactionId to a verified
order server-side. See
Security best practices.
impression
Fires the impression beacon for a banner or store you have displayed. It returns nothing.
CheggoutApp.impression(userID: virtualId, impressionInfo: href)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userID | String | Yes | The user's virtual ID. |
impressionInfo | String | Yes | The href field exactly as received from the banner or store response. Do not modify or truncate it. |
Call it when the creative becomes visible, not when the response arrives. In a paging carousel that means once per creative as it scrolls into view:
func carousel(_ carousel: Carousel, didDisplay banner: Banner) {
CheggoutApp.impression(userID: virtualId, impressionInfo: banner.href)
}
The href 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 parse the tag they need and fire the URL with a plain GET.
registerEvent
Not available
This method is not currently usable. It is listed here only so you recognise it if you find it in older integration material or in the framework's symbol list.
The historical specification, for reference only:
CheggoutApp.registerEvent(
VirtualId: virtualId,
EventType: "register", // or "referral"
SubEventType: "", // for referral, the referral code
additionalParams: "{\"isNewUser\":true}"
) { result in
// ...
}
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 committing to any work that depends on it. Tracked in
Open items.
The same caveat applies to ExitEvent. See
Register and Exit events.
Next
- Callbacks and notifications — completion handlers,
TrackUserActivity, reveal notifications and payment data. - Advertisement module — placements end to end.
- Scratch cards on the SDK.