Comment on page
Rewards
Handles Rewards related requests with IMS web services.
The SDK allows for the host application to retrieve a token, which in turn can be used by the host application to fetch data from the Rewards system (see documentation for the Rewards). In order to fetch that token, the application must have a valid user (represented by the Identity). That user must be active.
*Identity: In order to fetch that token, the application must have a valid user (represented by the Identity). That user must be active.
To fetch the token, one can use the following snippet
Swift
Kotlin
let rewards = RewardsService(identity: id)
rewards.fetchToken(then: { result in
let token = result.value.token
guard !token.isEmpty else {
// failure
return
}
completionHandler(.success(token))
})
val rewards = RewardsService(identity)
rewards.fetchToken(ResultCallback { result: Result<RewardToken?>? ->
if (result?.value == null || result.throwable != null) {
// failure
} else {
// Success
val token = result.value.token
completionHandler(token)
}
})
Last modified 2mo ago