Postback Documentation

Information and PHP Code

Postback Information

Please whitelist the IP 34.193.235.172 to ensure you receive postbacks.

These are the parameters that we will send to you with your postback to ensure proper tracking of your leads:
{status} - 1 -> Success | 2 -> Reversal
{trans_id} - Transaction ID, unique for each transaction.
{sub_id} - Affiliate sub specified in the tracking link.
{sub_id_2} - A second Affiliate sub specified in the tracking link.
{sub_id_3} - A third Affiliate sub specified in the tracking link.
{sub_id_4} - A fourth Affiliate sub specified in the tracking link.
{sub_id_5} - A fifth Affiliate sub specified in the tracking link.
{gross} - Amount paid in dollars to you for this particular transaction.
{amount} - Amount paid to affiliate for conversion. In your chosen conversion rate.
{offer_id} - ID of offer.
{offer_name} - Name of offer.
{category} - Category of offer. (Offer/Mobile/CC/Video etc..)
{os} - Mobile device OS. (android/ios)
{app_id} - ID of app.
{ip_address} - IP address of the user who completed the offer.
{signature} - An md5 created from the subid, amount and secret key separated by a colon.

*** Important note *** keep in mind that in case of chargebacks, the amount parameter will be negative.

PHP Code

<?php
// Your secret key can be found in your apps section by clicking on the "Secret Key" button
$secret_key = 'Your secret key';

// KiwiWall server IP addresses
$allowed_ips = array(
        '34.193.235.172'
);
// Proceess only requests from KiwiWall IP addresses
// This is optional validation
if (!in_array($_SERVER['REMOTE_ADDR'], $allowed_ips)) {
    echo 0;
    die();
}

// Get parameters
$status = $_REQUEST['status'];
$trans_id = $_REQUEST['trans_id'];
$sub_id = $_REQUEST['sub_id'];
$sub_id_2 = $_REQUEST['sub_id_2'];
$sub_id_3 = $_REQUEST['sub_id_3'];
$sub_id_4 = $_REQUEST['sub_id_4'];
$sub_id_5 = $_REQUEST['sub_id_5'];
$gross = $_REQUEST['gross'];
$amount = $_REQUEST['amount'];
$offer_id = $_REQUEST['offer_id'];
$offer_name = $_REQUEST['offer_name'];
$category = $_REQUEST['category'];
$os = $_REQUEST['os'];
$app_id = $_REQUEST['app_id'];
$ip_address = $_REQUEST['ip_address'];
$signature = $_REQUEST['signature'];

// Create validation signature
$validation_signature = md5($sub_id . ':' . $amount . ':' . $secret_key);
if ($signature != $validation_signature) {
    // Signatures not equal - send error code
    echo 0;
    die();
}
// Validation was successful. Credit user process.
echo 1;
die();
?>