The MVP Publisher UI Developer Hub

Welcome to the MVP Publisher UI developer hub. You'll find comprehensive guides and documentation to help you start working with MVP Publisher UI as quickly as possible, as well as support if you get stuck. Let's jump right in!

Server Side Rewarding

Introduction

Providing incentives for app users is a great way of encouraging customer engagement with your app. Incentives come in the form of in-app rewards and are offered to users in exchange for watching a video ad in full.

Important

To enable Server Side Rewarding you must first integrate rewarded ads, for a detailed guide click on the relevant OS:

Initializing the SDK

When initializing the SDK, there are no changes to be taken into consideration. The rewarded ad completion itself triggers Server Side Rewarding. However, you must make sure the User ID is set before this action happens, it can be set before or after initialization of the SDK.

Setting the User ID

Implement the below according to the correct operating system to set the User ID.

UserInfo.setUserId("myUserId");
// obj-c 
FYBUserInfo *userInfo = [FairBid user];
userInfo.userId = @"myUserId";

// swift
let userInfo = FairBid.user()
userInfo.userId = "myUserId"
UserInfo.SetUserId("myUserId");

Note

The User ID length must not exceed 256 characters. If it does, the Server Side Reward callback will not contain a User ID value.

If no User ID is set, the FairBid SDK uses:

  • The IDFV, for an iOS device.
  • The GAID, for an Android device.

Showing a Rewarded Ad

There is no change to consider when showing a rewarded ad since the callback is always triggered upon video completion.

You must make sure that the User ID is set to the value you are interested in before showing your rewarded ad.

Appending Custom Parameters

Use the code samples below to send extra parameters into your completion callback.

To do this, create an object with your custom parameters, which you pass using the show method.

Note

The total length of characters in the custom parameters collection must not exceed 4096. If it does, an empty collection of custom parameters is sent.

Map<String, String> customParameters = new HashMap<>();
customParameters.put("myCustomKey", "myCustomValue");
customParameters.put("anotherCustomKey", "anotherCustomValue");
RewardedOptions rewardedOptions = new RewardedOptions();
rewardedOptions.setCustomParameters(customParameters);
Rewarded.show("placementID", rewardedOptions, activity);
// obj-c 
FYBShowOptions *showOptions = [FYBShowOptions new];
showOptions.customParameters = @{@"myCustomKey": @"myCustomValue", @"anotherCustomKey": @"anotherCustomValue"};
[FYBRewarded show:@"placementID" options:showOptions];

// swift
let showOptions = FYBShowOptions()
showOptions.customParameters = ["myCustomKey": "myCustomValue", "anotherCustomKey": "anotherCustomValue"]
FYBRewarded.show("placementID", options: showOptions)
Dictionary<string, string> customParameters = new Dictionary<string, string>();
customParameters.Add("myCustomKey", "myCustomValue");
customParameters.Add("anotherCustomKey", "anotherCustomValue");
RewardedOptions rewardedOptions = new RewardedOptions();
rewardedOptions.CustomParameters = customParameters;
Rewarded.Show("placementID", rewardedOptions);

Configuring Endpoints in Fyber's Dashboard

  1. Log in to your Fyber account.

You can configure the endpoint in the Callback URL under Configure Placement in the Fyber dashboard.

  1. Under Server Side Rewarding, click Define Server to Server Callback.

The Callback URL and Security Token are displayed.

  1. Copy your security token, it is sent in each callback to enable you to validate that the response is coming from Fyber’s server.
  2. Click OK.

Important!

  • The Security token should be kept secret between your servers and Fyber's. Ensure that there is no possible way that any of your users can access it.
  • There is a significance to the order of the parameters in the Callback URL when computing the SHA1 hash of the request parameters.

Callback Structure and Behavior

Fyber calls your endpoint with the URL configured in the dashboard.

Before performing the GET request with the URL, Fyber replaces the following macros with information related to the video completion event.

Parameter
Mandatory
Description

USER_ID

Yes

The ID of the user to be credited

SIG

Yes

The value of the SIG macro is the SHA1 Hash of the values of all parameters in the URL (alphabetically sorted by parameter name) and the Security token displayed in the UI.

For example, if the callback URL is: https://mygamesdomain.com/callbacks.aspx?user_id=\USER_ID&reward_amount=AMOUNT&signature=SIG
and the security token in the UI is $%&
then the SHA1 hash of the string 2bananaEFGabc$%& should be c9534eec3f2ee1ba138a1a9ce3f8384e0b9cb465

AMOUNT

Yes

The amount of virtual currency the user should be credited.

CURRENCY_NAME

No

The name of the virtual currency being rewarded as it appears in the Fyber dashboard.

APP_ID

No

The Application ID as it appears in the Fyber dashboard.

SESSION_ID

No

The unique transaction ID in the form of a UUID (“Universally Unique Identifier”). Use this to check whether the transaction has already been processed in your system.

TIMESTAMP

No

Indicates the time stamp when the completion event occured.

Response Options

Fyber expects to receive a HTTP 200 response to indicate that the publisher has successfully processed the callback. If a HTTP 302 response is received, it is redirected a maximum of three times.

If the response is HTTP 400 or HTTP 401, will not retry that attempt. For any other response, will continue to resend the callback at increasing intervals until it receives a HTTP 200 response or until the maximum 10 tries limit is reached.

Fyber's server decides whether the callback request was successful based on the HTTP status code of your response.

Callback Request Type
Description

Response

A successful callback must return an empty response and a HTTP 200 status code. This indicates to our servers that you have successfully processed the callback. Any other response is interpreted as an unsuccessful callback (see below).

Redirects

Fyber’s servers follow HTTP redirects (status code 301 or 302), however, all redirect locations must be absolute URLs, as specified in the W3C standard.

Unsuccessful Callbacks

If an error occurs on your side, you may send any status code other than HTTP 200 to indicate to our servers that the callback was not processed successfully.

Any response other than HTTP 200 causes our system to resend the callback up to 10 additional times with an exponentially increasing delay between each attempt.

Duplicates and Rejected Callbacks

If you identify the callback request as a duplicate based on the _trans_id_, or if you choose to reject the callback intentionally, we recommend you to send an HTTP 200 status code response. In this way, this indicates to us that the callback was processed and there is no need to resend it.

Important

To ensure the security of your reward callbacks, our servers send a sig (signature) parameter to authenticate the event. We highly recommend you verify this on your end.

Server Side Rewarding


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.