Webhook Example
Below is a PHP example. This is code you could use in your own custom webhook file to be called by iDevAffiliate. Your app should return a 200 OK HTTP status code in reply to a Webhook. This lets iDevAffiliate know that you received the Webhook.
<?PHP
if ($_SERVER['REMOTE_ADDR'] != 'xxx.xxx.xx.xx') { // server IP here
header('HTTP/1.1 403 Forbidden');
mail('mail@mail.com', 'Webhook called from invalid IP.', $_SERVER['REMOTE_ADDR']);
exit;
}
$json = file_get_contents('php://input');
$idev = json_decode($json, true);
if (empty($idev['event'])) {
header('HTTP/1.1 400 Bad Request');
exit;
}
switch ($idev['event']) {
case 'commission.created':
// Your code here.
// Example:
// $ordernumber = $idev['order_number'];
break;
}
header("HTTP/1.1 200 OK");
?>