Postback Documentation

Information and PHP Code

Postback Information

Please whitelist the IP 129.226.183.37 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.
{s2} - A second 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.
{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(
                '129.226.183.37'
        );
        // 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'];
        $s2 = $_REQUEST['s2'];
        $gross = $_REQUEST['gross'];
        $amount = $_REQUEST['amount'];
        $offer_id = $_REQUEST['offer_id'];
        $offer_name = $_REQUEST['offer_name'];
        $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();
?>