Quick Info : When a user successfully completes an offer, we immediately trigger a call to the Postback URL you have provided in your placement. This call contains all the relevant information required to credit your users, serving as a real-time notification to your server.
Postback Parameters
PARAMETER
DESCRIPTION
EXAMPLE
[USER_ID]
The unique identifier for the user making the claim.
user12345
[REWARD]
The reward amount in Your currancy given for the user.
500
[TXID]
The unique transaction ID associated with the claim.
tx78910
[DEVICE]
The type of device used by the user (e.g., mobile, desktop).
mobile
[PAYOUT]
The amount in dollars given for the publisher.
1
[SIGNATURE]
A security signature to verify the claim's authenticity.
abc123signature
[OFFER_NAME]
The name of the offer associated with the claim.
Lords Mobile
[OFFER_ID]
The unique identifier for the offer.
Oc1442148444
[STATUS]
The status of the claim (e.g., pending, approved).
"0" for rejected , "1" for success, "2" for rejected
[USER_IP]
The IP address of the user making the claim.
192.168.1.1
[COUNTRY]
The country from which the claim was made.
US
[USER_ID] and [REWARD] are always required and cannot be null.
Your server ip have to reply with "ok" for success postback response
<?php$user_id =isset($_REQUEST['user'])? $_REQUEST['user'] :"";$reward =isset($_REQUEST['reward'])? $_REQUEST['reward'] :"";$transactionId =isset($_REQUEST['txid'])? $_REQUEST['txid'] :"";$device =isset($_REQUEST['device'])? $_REQUEST['device'] :"";$payout =isset($_REQUEST['payout'])? $_REQUEST['payout'] :"";$signature =isset($_REQUEST['signature'])? $_REQUEST['signature'] :"";$offer_name =isset($_REQUEST['offer_name'])? $_REQUEST['offer_name'] :"";$offer_id =isset($_REQUEST['offer_id'])? $_REQUEST['offer_id'] :"";$status =isset($_REQUEST['status'])? $_REQUEST['status'] :"";$user_ip =isset($_REQUEST['user_ip'])? $_REQUEST['user_ip'] :"";$country =isset($_REQUEST['country'])? $_REQUEST['country'] :"";$allowed_ip ='199.188.200.154'; // Define the allowed IP address for security$timeCurrent =time(); // Current timestamp for tracking$configs =newfunctions($dbo); // Initialize configuration functions// Step 1: Verify the signature to ensure the request is authentic// (Remove this if you want to test postback)$expected_signature =md5($user_id . $transactionId . $reward ."Your_Secret_Key");if ($signature !== $expected_signature) {// Log the unauthorized attempt and return an errorerror_log("Unauthorized signature");api::printError(ERROR_UNKNOWN,"Unauthorized signature");exit;}// Step 2: Check if the request is coming from the allowed IP addressif ($_SERVER['REMOTE_ADDR'] !== $allowed_ip) {// Log the unauthorized IP access and return an errorerror_log("Unauthorized access attempt from IP: ". $_SERVER['REMOTE_ADDR']);api::printError(ERROR_UNKNOWN,"Unauthorized access");exit;}// Step 3: Define your function for verify and store these data Here// Return "ok" if everything is processed successfully and it have to be ok to response successecho"ok";?>
<?phpinclude_once("../admin/core/init.inc.php");// Example Postback URL:// https://your_site.com/adport.php?user_id=[USER_ID]&point_value=[REWARD]&tx=[TXID]&device=[DEVICE]&payout=[PAYOUT]&signature=[SIGNATURE]&offer_name=[OFFER_NAME]&offer_id=[OFFER_ID]&status=[STATUS]&ip=[USER_IP]&country=[COUNTRY]
/* * Extracting parameters from the request. * If a parameter is not found, it will be set to an empty string. */$user_id =isset($_REQUEST['user'])? $_REQUEST['user'] :"";$reward =isset($_REQUEST['reward'])? $_REQUEST['reward'] :"";$transactionId =isset($_REQUEST['txid'])? $_REQUEST['txid'] :"";$device =isset($_REQUEST['device'])? $_REQUEST['device'] :"";$payout =isset($_REQUEST['payout'])? $_REQUEST['payout'] :"";$signature =isset($_REQUEST['signature'])? $_REQUEST['signature'] :"";$offer_name =isset($_REQUEST['offer_name'])? $_REQUEST['offer_name'] :"";$offer_id =isset($_REQUEST['offer_id'])? $_REQUEST['offer_id'] :"";$status =isset($_REQUEST['status'])? $_REQUEST['status'] :"";$user_ip =isset($_REQUEST['user_ip'])? $_REQUEST['user_ip'] :"";$country =isset($_REQUEST['country'])? $_REQUEST['country'] :"";$allowed_ip ='199.188.200.154'; // Define AdPortHub allowed IP address for security$timeCurrent =time(); // Current timestamp for tracking$configs =newfunctions($dbo); // Initialize configuration functions// Step 1: Check if the request is coming from the our serversif ($_SERVER['REMOTE_ADDR'] !== $allowed_ip) {// Log the unauthorized IP access and return an errorerror_log("Unauthorized access attempt from IP: ". $_SERVER['REMOTE_ADDR']);api::printError(ERROR_UNKNOWN,"Unauthorized access");exit;}// Step 2: Verify the signature to ensure the request is authentic$expected_signature =md5($user_id . $transactionId . $reward ."Your_Secret_Key");if ($signature !== $expected_signature) {// Log the unauthorized attempt and return an errorerror_log("Unauthorized signature");api::printError(ERROR_UNKNOWN,"Unauthorized signature");exit;}// Step 3: Retrieve the user data based on the provided user_id$account =newaccount($dbo,1);$userdata = $account->getuserdata($user_id);// Validate the user data against the requestif ($userdata['username'] != $user_id) {api::printError(ERROR_UNKNOWN,"Account Mismatch");exit;}// Step 4: Calculate the new balance by adding the reward points$amount = $reward;$newBalance = $userdata['points'] + $amount;// Step 5: Update the user's points in the database$sql ="UPDATE users SET points = :points WHERElogin= :user_id";$stmt = $dbo->prepare($sql);$stmt->bindParam(':points', $newBalance,PDO::PARAM_INT);$stmt->bindParam(':user_id', $user_id,PDO::PARAM_STR);$stmt->execute();// Step 6: Insert a new record into the tracker table for logging$sql ="INSERT INTO tracker(username, points, type, date) VALUES (:user_id, :amount, :type, :date)";$stmt = $dbo->prepare($sql);$type ="credit"; // Assuming type is always "credit"$stmt->bindParam(':user_id', $user_id,PDO::PARAM_STR);$stmt->bindParam(':amount', $amount,PDO::PARAM_INT);$stmt->bindParam(':type', $type,PDO::PARAM_STR);$stmt->bindParam(':date', $timeCurrent,PDO::PARAM_INT);// Step 7: Execute the tracker insert and send a push notificationif ($stmt->execute()) { $configs->sendPush($userdata['gcm'],"credit", $amount,"none","none");}// Return "ok" if everything is processed successfully and it have to be ok to response successecho"ok";?>
Verify with ip address
$allowed_ip ='199.188.200.154';if ($_SERVER['REMOTE_ADDR'] !== $allowed_ip) {// Log the unauthorized IP access and return an errorerror_log("Unauthorized access attempt from IP: ". $_SERVER['REMOTE_ADDR']);api::printError(ERROR_UNKNOWN,"Unauthorized access");echo"Unauthorized access attempt";exit;}
Verify with ip signature
$signature =isset($_REQUEST['[SIGNATURE]'])? $_REQUEST['[SIGNATURE]'] :"";$expected_signature =md5($user_id . $transactionId . $reward ."Your_Secret_Key");if ($signature !== $expected_signature) {// Log the unauthorized attempt and return an errorerror_log("Unauthorized signature");api::printError(ERROR_UNKNOWN,"Unauthorized signature");echo"Unauthorized signature";exit;}
Issues or Questions: Contact AdPortHub support at support@adporthub.com for assistance.