Payout

In order for the user to redeem his collected rewards, they must be paid out. A reward can only be paid out exactly once.

There are two methods to pay out the rewards: via server-to-server payout or via the SDK. The two methods are mutually exclusive. You can only use either server-to-server payout or the SDK payout. Please discuss with your account manager which method to use.

Server-to-server payout

In order to use the server-to-server payout, you need to create an endpoint on your server that we can request in order to notify you of the user's rewards. Once you receive the notification, it will be up to you to deliver it to the user.

We highly recommend using server-to-server payout for rewards due to higher security and better transparency on your end.

Endpoint structure

We will call your endpoint with an HTTP GET request and the configured parameters:

Parameter

Detail

format

user_uuid

The Id of the user that should get the rewards

UUID v4

sid

The request signature, which should be used to verify request authenticity. sid is computed as a SHA1 hash of the request parameters as sid = sha1(concatenate(trans_uuid, user_uuid, currency, coin_amount, device_id, sdk_app_id, s2s_token))

string

coin_amount

The amount of virtual currency the user should get

integer

currency

The name of the virtual currency

string

trans_uuid

The unique transaction ID

UUID v4

device_id

optional device id

string

app_name

URL encoded app name in English

string

sdk_app_id

optional app id of the sdk

string

app_id

optional app id that generate the usage

string

sdk_sub_id1

optional sub id one passed from SDK to track the request

string

sdk_sub_id2

optional sub id two passed from SDK to track the request

string

reward_level

optional reward level

string

reward_type

optional reward type

string

Security

To ensure that requests come from us, you should calculate the sid parameter and compare it to the parameter sent in the callback. It is calculated as follows: sid = sha1(concatenate(trans_uuid, user_uuid, currency, coin_amount, device_id, sdk_app_id, s2s_token)) We will supply you with the parameter s2s_token separately.

Example Endpoint URL: https://example.com/example?[YourParamName]={user_uuid}&[YourParamName]={sid}&[YourParamName]={coin_amount}&[YourParamName]={currency}&[YourParamName]={trans_uuid}&[YourParamName]={sdk_sub_id1}&[YourParamName]={sdk_sub_id2}

Via SDK

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

import io.adjoe.sdk.AdjoePayoutEvent;

...

private function doAdjoePayout():void {
  adjoe.addEventListener("onPayoutSuccess", onPayoutSuccess);
  adjoe.addEventListener("onPayoutError", onPayoutError);

  adjoe.doPayout();
}

private function onPayoutSuccess(event:AdjoePayoutEvent):void {
  trace("Adjoe payout was successful with " + event.getCoins() + " coins");
}

private function onPayoutError(event:AdjoePayoutEvent):void {
  trace("Adjoe payout failed with reason " + event.getReason());
}

This method always pays out all coins which the user has collected, i.e. the value of adjoeRewardsEvent.getAvailablePayoutCoins().

If the user has not accepted the adjoe Terms of Service yet, this operation will fail and event.getReason() will be equal to AdjoePayoutEvent.REASON_TOS_NOT_ACCEPTED. You might want to display the offerwall again so that the user can accept the adjoe Terms of Service. This operation will also fail with event.getReason() equal to AdjoePayoutEvent.REASON_UNKNOWN if the user is blocked by the adjoe services.

Adjoe Parameters

You can pass additional UA and placement parameters when you launch Playtime:

var adjoeParams:AdjoeParams = new AdjoeParams();
adjoeParams.setUaNetwork("uaNetwork");
adjoeParams.setUaChannel("UaChannel");
adjoeParams.setUaSubPublisherCleartext("UaSubPublisherCleartext");
adjoeParams.setUaSubPublisherEncrypted("UaSubPublisherEncrypted");
adjoeParams.setPlacement("Placement");

adjoe.doPayout(adjoeParams);

Last updated