gpszymczak
10/15/2013 - 1:11 PM

How to add missing welcome bonus.

How to add missing welcome bonus.

<?php

$username = 'USERNAME';
$api_key = 'API_KEY';

$api_url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/json/commission/add';

$commadd_data = array(
  'campaign_uid' => 'CAMPAIGN_UID',
	'email' => 'AMBASSADOR_EMAIL',
	'amount' => 'WELCOME_BONUS_AMOUNT',
	//'transaction_uid' => 'TRANS_UID_OF_ORIGINAL_COMMISISON',
	'is_approved' => 0,
	'is_welcome_bonus' => 1,
);

$commadd_data = http_build_query($commadd_data);

// Call event via API
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $api_url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $commadd_data);

$buffer = curl_exec($curl_handle);

// Output
$returnData = json_decode($buffer, TRUE);
var_dump($returnData);

curl_close($curl_handle);