Mobile App

To run a mini-game in a mobile app, Webview functionality must be supported.

No leaderboard is provided after the game. The brand’s app and system send the user ID (e.g., customer ID) to the mini-game system, and the game results, along with the user ID, are sent back to the brand's app and system via a webhook. To use this service, the brand’s app and system must support the Webhook feature.

You can use the userid and Webhook to send game-related data to the brand's server after the game.

Basic scenario

  1. When the mini-game is launched in the mobile app, the user ID (userid) is retrieved from the brand server via a GET request and sent to the mini-game execution URL.

  2. The mini-game runs within a Webview environment.

  3. After the game ends, the game score is displayed on the result screen.

  4. The brand server receives game-related data through a Webhook.

  5. Based on the received data, the brand server operates its own leaderboard and reward program.

Setup process

  1. The brand creates a mini-game using Studio.

  2. The brand must set up a Webhook program on their server to receive game result data.

  3. The brand applies the received data to their own leaderboard or reward program based on the data transmitted via Webhook.

Instructions on how to apply

When retrieving the mini-game URL value from the Webview, the 'userid' parameter and its value must be included using the GET method.

Parameter

NameDescriptionFormatSample

userid *

Unique ID generated from the customer's system

Alphanumeric (case-sensitive) + up to 20 digits

T4g4fLTaorjames

Example, Original campaign URL address https://branded.mini-games.io/?php=landing@8NKHT2hK&campaign_no=1 The brand's system must call this URL and send the "userid".

https://branded.mini-games.io/?php=landing@8NKHT2hK&campaign_no=1&userid=T4g4fLTa

After the game, the result value is sent to the brand's Webhook URL

After the game, the result value and various data are received by the brand’s server through the Webhook created by the brand.

NameDescriptionSample

userid *

User's unique ID

T4g4fLTa or james

tx_id *

Unique ID for each game played

234234

time *

Datetime when the game player attempted to play

2023-04-10 06:39:23

score *

Score obtained by the game player

3500

playtime*

Duration of play by the game player (in seconds)

20

* Indicates a required value.

Return Code

The brand server must return the result code to our studio system.

Code valueDescription

S

When successful

F

When failing If you want to state the reason for failure, you can add text after the "F" code. Example) "F: Score is missing."

PHP example

// getting data
isset($_POST[‘userid’]) ? $userid = $_POST[‘userid’] : $userid = ”;
isset($_POST[‘tx_id’]) ? $tx_id = $_POST[‘tx_id’] : $tx_id = ”;
isset($_POST[‘score’]) ? $score = $_POST[‘score’] : $score = ”;
isset($_POST[‘playtime’]) ? $playtime = $_POST[‘playtime’] : $playtime = ”;
isset($_POST[‘time’]) ? $time = $_POST[‘time’] : $time = ”;
// checking validity
if (trim($score) == “”) {
    echo “F : score is missed”;
    exit;
}
if (trim($playtime) == “”) {
    echo “F : playtime is missed”;
    exit;
}
if (trim($time) == “”) {
    echo “F : time is missed”;
    exit;
}
// saving data into database
$sql  = “insert into playing_log (‘tx_id’, ‘userid’, ‘time’, ‘score’, ‘playtime’) values (‘”.$tx_id.”‘, ‘”.$userid.”‘, ‘”.$time.”‘, ‘”.$score.”‘, ‘”.$playtime.”‘);”;
//echo $sql;
// connection DB
// insert data
~~~
// result of saving
if ($result) {
    echo “S”;
}
else {
    echo “F : DB failure”;
}

To obtain parameter values when the returned data is in JSON format, you must first parse the data.

Last updated