⚙️Postback

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 DESCRIPTIONEXAMPLE

[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

Example postback url:

https://example.com/adporthub.php?user=[USER_ID]&reward=[REWARD]&device=[DEVICE]&txid=[TXID]&payout=[PAYOUT]&signature=[SIGNATURE]&offer_name=[OFFER_NAME]&offer_id=[OFFER_ID]&status=[STATUS]&user_ip=[USER_IP]&country=[COUNTRY]
<?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 = new functions($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 error
    error_log("Unauthorized signature");
    api::printError(ERROR_UNKNOWN, "Unauthorized signature");
    exit;
}

// Step 2: Check if the request is coming from the allowed IP address
if ($_SERVER['REMOTE_ADDR'] !== $allowed_ip) {
    // Log the unauthorized IP access and return an error
    error_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 success
echo "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 error
    error_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 error
    error_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.

Last updated