Comment on page
There are some other methods in the adjoe SDK which you might find helpful.
The following information on SDK-side reward handling is only relevant for your integration if you cannot use Server-to-Server Payout. Do not implement these functions if you already successfully followed the steps in the Payout section - it could trigger error messages and unexpected behaviour.
If you cannot handle the payout requests via an endpoint on your server, we can also handle the reward payouts inside the SDK itself.
To pay out the rewards that the user has collected from partner apps directly in the SDK, call
// the payout was successful
// the the amount of coins which were paid out
var coins = msg['payout_coins'];
// an error occurred while paying out the coins
// get the reason why it failed
var reason = errMsg['reason'];
// 'reason' is one of
// - window.AdjoePlugin.ERR_PAYOUT_NOT_ENOUGH: the user has not collected enough coins to pay out
// - window.AdjoePlugin.ERR_PAYOUT_TOS: the user has not accepted the adjoe Terms of Service
// - window.AdjoePlugin.ERR_PAYOUT_UNKNOWN: there is no detailed information about the error available
This method always pays out all rewards which the user has collected, i.e. the value of
If the user has not accepted the adjoe Terms of Service yet, this operation will fail and
reasonwill be equal to
window.AdjoePlugin.ERR_PAYOUT_TOS. You might want to forward to Playtime again so that the user can accept the adjoe Terms of Service. This operation will also fail with
window.AdjoePlugin.ERR_PAYOUT_UNKNOWNif the user is blocked by the adjoe services.
You can pass two optional Sub-IDs when you pay out the rewards:
window.AdjoePlugin.doPayoutWithSubIDs('<subId1>', '<subId2>', success, error).
You can get information about the rewards that the user has collected as well as about how many rewards are available for payout and how many the user has already spent.
To do so call
// successfully requested the rewards
// get the total amount of coins which the user has collected
var reward = msg['reward'];
// get the amount of coins which the user has already spent
var alreadySpentCoind = msg['already_spent_coins'];
// get the amount of coins which are available for payout
var availableForPayout = msg['available_for_payout'];
// an error occurred while requesting the rewards
This operation will fail if the SDK is not initialized, the user has not accepted the adjoe Terms of Service or is blocked by the adjoe services.
You can pass two optional Sub-IDs when you request the rewards:
window.AdjoePlugin.getRewardsWithSubIDs('<subId1>', '<subId2>', success, error).