HomeAppVirality DocsAppVirality APIsGet User Balance i.e. Friend/Referrer

Get User Balance i.e. Friend/Referrer

This API Call shall enable you to pull up earnings data for any user


Gets you the individual balance/earnings data for any User – Referrer/Friend

This API call shall help you obtain the complete earnings data of a user at any point in time. It is an important call when thinking from the perspective of personalizing the user experience in the app.

The call shall return individual detailed earnings data, i.e. it will list out rewards pooled together per campaign per growth hack, available to the user. Hence the rewards across multiple growth hacks shall reflect as multiple nested records in the response payload.

Base URL  https://api.appvirality.com

 POST         /v2_0/getuserbalance

Content-Type application/json


Input i.e. Request

{
"userkey":"588d87d8d9e89ac5d710caf68910ac5d",
"apikey":"7ffdda00fd5c4338a9c1a44e00663648",
"privatekey":"d1e881dc60fa4856be34a44f00d96c9a",
"EmailId": "",
"UserIdInstore": "",
"campaignId": "214",
"growthHack": "Word_of_Mouth"
}
Input Params
Input Params Description
userkey
(conditional)
User Key for the an App user, assigned by AppVirality – a unique identifier for every App User recorded
EmailId
(conditional)
Email of the User, updated to AppVirality
UserIdInstore
(conditional)
Store Id of the App user, updated to AppVirality – a unique identifier of the user in your App
apikey API Key of the App
Get it from Dashboard >> App Details
privatekey Private key for API requests
Get it from: Dashboard >> App Details >> Click App Settings >> Scroll down to Advanced Settings
campaignId
(optional)
Unique ID of a campaign (helps you filter rewards)
growthHack
(optional)
Type of Growth Hack (helps you filter rewards) 
values: Word_of_Mouth or Loyalty_Program

conditional – One of the conditional parameters is mandatory to identify the user. Priority for user identification is userkey, UserIdInstore and EmailId

 


Response

{
  "userBalance": {
    "total": 900,      // Total earnings of user
    "claimed": 700,    // Amount marked rewarded to the user
    "pending": 200,    // Yet to be rewarded
    "growthHacks": [
      {
        "ghName": "Word_of_Mouth", // growth hack name
        "total": 700,   // Total earnings of user - for this growth hack
        "claimed": 700, // Amount marked rewarded to the user - for this growth hack
        "pending": 0,   // Yet to be rewarded - for this growth hack
        "campaigns": [
          {
            "campaignId": 214,
            "campaignName": "campign",
            "total": 700,   // Total earnings of user - for this campaign
            "claimed": 700, // Amount marked rewarded to the user - for this campaign
            "pending": 0,   // Yet to be rewarded - for this campaign
            "ghName": "Word_of_Mouth", 
            "rewardUnit": "Rs"
          }
        ]
      },
      {
        "ghName": "Loyalty_Program", 
        "total": 200,
        "claimed": 0,
        "pending": 200,
        "campaigns": [
          {
            "campaignId": 215,
            "campaignName": "loylcampign",
            "total": 200,
            "claimed": 0,
            "pending": 200,
            "ghName": "Loyalty_Program",
            "rewardUnit": "Rs"
          }
        ]
      }
    ]
  },
  "success": true,
 "statuscode": 1,
  "message": success
}


NOTE

~ preceding a parameter e.g. ~ rewardunit, implies the param is a nested/subset of the most recent non-tilde param, i.e. in this case rewardunit is a sub/nested param under userpoints

 

Response Params
Output Params Description
success Response status
message Information regarding API call (if relevant)
status code code based on status of the API call
userBalance Reward detail
~ total Total Earnings of the user
~ claimed Amount marked as rewarded
~ pending Amount yet to be rewarded
~ growthHacks Collection of Rewards detail – per Growth Hack basis
~ campaigns Collection of Rewards detail – per Campaign basis
~ campaignId Unique ID of a campaign, generated by AppVirality
~ campaignName Campaign Name, given in AppVirality dashboard
~ rewardUnit Reward Unit

Status codes which you will see while using Getuserbalance API

Status codes and description for API responses
Status Code Description
0 No data found for the search criteria
1 Success
2 Invalid User Key
3 Invalid GrowthHack
4 Invalid CampaignID
5 Invalid StoreID or EmailID
Was this article helpful to you? Yes No