Dashboard

Using the SDK

Once you have set up and initialized the SDK you can use its features:

Playtime Access

The Playtime feed comprises apps that users can install and utilize to earn rewards. This feed is presented in a distinct activity.

In order to launch playtime, call:

{ AppsPrize.launch()
 }

This function allows you to launch AppsPrizeActivity to show available campaigns and track apps' reward progress. If AppsPrize is not initialized, it returns false.

Prior to the user's interaction with the partner apps in their feed, they are required to agree to the AppsPrize Terms of Service. Additionally, they have the option to grant your app permission to track the usage of other apps on their phone through the device settings.

You can use the hasPermissions function.

{AppsPrize.hasPermissions()
            .then(has => console.log(`AppsPrize:TS:hasPermissions - ${has}`))
            .catch(err => console.log(`AppsPrize:TS:hasPermissions - ${err}`))
        }

This function allows you to check for permission status to track rewards.

requestPermission allows you to manually request permission to track rewards. If permission is not available, it forwards to Android settings.

{AppsPrize.requestPermission()
            .then(has => console.log(`AppsPrize:TS:requestPermission - ${has}`))
            .catch(err => console.log(`AppsPrize:TS:requestPermission - ${err}`))
        }

Payout

To enable users to claim their accumulated rewards, they need to receive a payout. Each reward can be redeemed only once.

Server-to-server Payout

To utilize server-to-server payout, you should establish an endpoint on your server, which we can trigger to inform you about the user's rewards. Upon receiving this notification, the responsibility of delivering the rewards to the user lies with you.

📘

We strongly advise adopting the server-to-server payout method for rewards due to its enhanced security and improved transparency on your side.

Endpoint Structure

Once you share your endpoint URL, we will useHTTP POSTrequest in order to send callback to your side. We will set the below query parameters and fill statically once an install occurs. You need to parse the parameters and handle on your side.

ParameterDescriptionFormatType
user_idUnique client app's user IDstringmandatory
coin_currencycurrency name of client appstringmandatory
coin_amountTotal number of reward amount that will be earned by the users when they completed whole levelsfloatmandatory
cpi_bidoffer cpi bidfloatmandatory
payout_currencycurrency of offer cpi bid (USD)stringmandatory
device_idadvertising ID of end-user from installstringoptional
trans_idThe unique transaction IDUUID v4mandatory
sigSignature that should be verified request authenticity. It's a SHA256 hash code of the calculation of the request parameters as sig=SHA256(concatenate(trans_id,user_id,coin_amount,coin_currency ,app_token,s2s_token)stringmandatory

In order to be ensure that the callback requests are coming from us, you need to calculate the sig parameter and compare with the parameters which are sent by the callback request. Calculation is; sig=SHA256(concatenate(trans_id,user_id,coin_amount,coin_currency ,app_token,s2s_token).

Once you share the main endpoint S2S URL, s2s_token will be generated and given to you.

🚧

We will make POST requests whenever a user installs and open the apps, also completes a reward level separately.

Sample Body for Install Request

{
  "app_bundle_id": "com.oakgames.linked2248.numberpuzzle",
  "app_name": "2248: Number Puzzle Game",
  "coin_amount": 10000,
  "coin_currency": "USD",
  "cpi_bid": 0.15,
  "sig": "5d775fa8d601ffdea8a65fd0225e0637d2b87b57072483dd0dcc49aa735c9b", // (trans_id, user_id, coin_amount, coin_currency, app_token, s2s_token)
  "trans_id": "36097a85-5e1b-44b6-8966-0e2e226b7a0",
  "type": "install",
  "user_id": "test1"
}

Sample Body for Rewards

{
  "app_bundle_id": "com.sport.cornhole",
  "app_name": "Cornhole League",
  "coin_amount": 10000,
  "coin_currency": "USD",
  "rewards": 
    {
      "level": 1,
      "seconds": 60,
      "points": 18,
      "currency": "Points"
    },
    {
      "level": 2,
      "seconds": 60,
      "points": 18,
      "currency": "Points"
    },
    {
      "level": 3,
      "seconds": 60,
      "points": 18,
      "currency": "Points"
    }
  ],
  "sig": "5d775fa8d601ffdea8a65fd0225e0637d2b87b57072483dd0dcc49aa735c9b", // (trans_id, user_id, coin_amount, coin_currency, app_token, s2s_token)
  "trans_id": "4a66188d-4278-487d-8953-b33c0c85ff9f",
  "type": "reward",
  "user_id": "test1"
}

Payout via SDK

❗️

We recommend that you use the server-to-server payout model for better security and transparency, but if you cannot handle the server requests on your side, you can call the doReward function as below.

We will handle the reward payouts inside the SDK itself by this method.

To pay out the rewards that the user has collected from advertiser apps directly in the SDK, call

{AppsPrize.doReward((rewards) => {
            console.log(`AppsPrize:TS:doReward - ${JSON.stringify(rewards)}`)
          })
        }}