Appearance
Rewards System
Upshot's rewards module helps to reward users based on the actions/activities performed by them on a mobile app or a website. This module allows to boost retention and helps increase user's loyalty towards applications.
Overview
Upshot provides several APIs (methods) to:
- Fetch Reward Programs - Get list of active reward programs achieved by the user
- View Transaction History - Track all reward transactions and activities
- Access Reward Rules - Understand how users can earn rewards
- Redeem Rewards - Allow users to redeem their earned rewards
The rewards system helps you:
- Boost user retention through meaningful incentives
- Increase user loyalty and engagement
- Track user progress and reward achievements
- Create gamified experiences that drive specific behaviors
Reward Status
Get a list of active reward programs using the getRewardsList
method:
objective-c
@import Upshot;
// Fetch active reward programs
[[BrandKinesis sharedInstance] getRewardsStatusWithCompletionBlock:^(NSDictionary * _Nullable response, NSString * _Nullable errorMessage) {
}];
swift
import Upshot
// Fetch active reward programs
BrandKinesis.sharedInstance().getRewardsStatus { (response, error) in
}
Sample Response
json
{
"status": "success",
"statusCode": 200,
"status_code": 200,
"data": [
{
"program_description": "",
"display_name": "",
"program_name": "Sample",
"programId": "5dd268259834967b62dd6ff4",
"logo_url": "https://s3.amazonaws.com/albdock-bk/shared_folder/media/images/5dd26822442c2.png",
"balance": 60,
"rewards_redeemed": 20,
"rewards_earned": 120,
"rewards_penalty": 40,
"rewards_expired": 0
}
]
}
Redeem Rewards
Use the redeemRewardsForProgram
method to request reward redemption. Upshot will check the user's balance against the redeem value and provide the status of the request.
objective-c
@import Upshot;
// Redeem rewards for a program
NSString *programId = @"5dd268259834967b62dd6ff4";
NSNumber *transactionValue = @(100.0);
NSNumber *redeemAmount = @(50);
NSString *tag = @"discount";
[[BrandKinesis sharedInstance] redeemRewardsWithProgramId:programId transactionValue:transactionValue redeemAmout:redeemAmount
tag:tag withCompletionblock:^(NSDictionary * _Nullable response, NSString * _Nullable errorMessage) {
}];
swift
import Upshot
// Redeem rewards for a program
let programId = "5dd268259834967b62dd6ff4"
let transactionValue = 100.0
let redeemAmount = 50
let tag = "discount"
BrandKinesis.sharedInstance().redeemRewards(withProgramId: programId, transactionValue: transactionValue, redeemAmout: redeemAmount, tag: tag) { (response, error) in
}
Parameters for Reward Redemption
- Program ID - ID of the active reward program (can be fetched from status API)
- Transaction Value - Value of the transaction
- Redeem Value - Value of rewards to be redeemed
- Tag - Type/category of rewards to be redeemed
Sample Responses
Success Response:
json
{
"status": "success",
"statusCode": 200
}
Failure Response:
json
{
"status": "Failed",
"statusCode": 200,
"statusMessage": "balance insufficient"
}
Reward History
Use the getRewardHistoryForProgram
method to get the transaction history for a specific reward program based on programId
and historyType
.
objective-c
@import Upshot;
// Fetch reward history
NSString *programId = @"5dd268259834967b62dd6ff4";
NSInteger transactionType = RewardEntireHistory;
[[BrandKinesis sharedInstance] getRewardHistoryForProgramId:programId withHistoryType:transactionType withCompletionBlock:^(NSDictionary * _Nullable response, NSString * _Nullable errorMessage) {
}];
swift
import Upshot
// Fetch reward history
let programId = "5dd268259834967b62dd6ff4"
BrandKinesis.sharedInstance().getRewardHistory(forProgramId: programId, with: .entireHistory) { (response, error) in
}
Transaction Types
- RewardEntireHistory (0) - Includes all transaction types
- RewardEarnHistory (1) - Shows only earned history
- RewardExpiryHistory (2) - Shows expired history
- RewardRedeemHistory (3) - Shows only redeemed history
- RewardNegativeHistory (4) - Shows negative/penalty history
Sample Response
json
{
"status": "success",
"statusCode": 200,
"status_code": 200,
"data": [
{
"transaction_value": null,
"transaction_type": 4,
"transaction_date": 1574090603,
"reward_value": 10,
"tag": "pumping"
},
{
"transaction_value": null,
"transaction_type": 1,
"transaction_date": 1574091350,
"reward_value": 60,
"tag": "pumping"
}
]
}
Reward Rules
Use the getRewardRulesforProgram
method to get the list of rules with name, description, and tag associated for a given programId
.
objective-c
@import Upshot;
// Fetch earning rules for rewards
NSString *programId = @"5dd268259834967b62dd6ff4";
[[BrandKinesis sharedInstance] getRewardDetailsForProgramId:programId withCompletionblock:^(NSDictionary * _Nullable response, NSString * _Nullable errorMessage) {
}];
swift
import Upshot
// Fetch earning rules for rewards
let programId = "5dd268259834967b62dd6ff4"
BrandKinesis.sharedInstance().getRewardDetails(forProgramId: programId) { (response, error) in
}
Parameters
- Program ID - ID of the active reward program (can be fetched from status API)
Sample Response
json
{
"status": "success",
"statusCode": 200,
"status_code": 200,
"data": {
"programId": "5dd268259834967b62dd6ff4",
"program_description": "",
"rules": [
{
"rule_name": "World Rule-1",
"ruleId": "5dd268e6c322233ae963830e",
"tag": "tag",
"rule_description": ""
},
{
"rule_name": "World Rule-2",
"ruleId": "5dd2694a9834967b62dd6ff5",
"tag": "tag",
"rule_description": ""
}
]
}
}