How to add monthly commission bonus

This scenario will show you a simple script that you can use for assigning special commission bonus to affiliates.

Requirements
You will need one php file into which you will add the code. If you want to do this automatically, you will need a cron job.

Code
<?php
 $array = array('11111111', '41802005', 'd71d2189'); // here you have to add all bonus affiliates IDs or refIDs
 for ($i = 0; $i < size($array); $i++) {
    echo '<img src="https://www.yoursite.com/pap_4/scripts/sale.php?TotalCost=100&OrderID=monthly_bonus&AffiliateID='.$array[$i].'" width="1" height="1" />';
}
?>
You can modify number of affiliates in the code, by removing them from array or adding a new one. Next, you can modify total cost, orderID ... you can adjust pixel tracker as you need... E.g. you can replace totalCost with CustomCommission.

Important variable is AffiliateID - this have to be there so the commission can be saved to proper affiliate.

Automatization
This file you have to run manually each month. If you want to make this automatically then you will need to set a cron job and adjust the script a little bit.
<?php
include 'URL_TO_PAP/api/PapApi.class.php';
$array = array('11111111', '41802005', 'd71d2189'); // the same array with affiliates
$saleTracker = new Pap_Api_SaleTracker('URL_TO_PAP/scripts/sale.php');
 
for ($i = 0; $i < size($array); $i++) {
  $sale = $saleTracker->createSale();
  $sale->setTotalCost(100);
  $sale->setOrderID('monthly_bonus');
  $sale->setAffiliateID(\'$array[$i]\');
}

$saleTracker->register();

?>
×