/*
* On your action method just do something like this
*/
//the advocate token of the customer that has place the payment
$strGRAdvocateToken = 'cc6bdb82850654d89bebada2b52e80289b098c1d3';
// Create a new GRPHPAPIClient object
$objGeniusReferralsAPIClient = new GRPHPAPIClient('YOUR_USERNAME', 'YOUR_API_TOKEN');
//preparing the data to be sent on the request
$arrParams = array(
'bonus' => array(
'advocate_token' => $strGRAdvocateToken, //the advocate who made the payment
'reference' => rand(1000000, 9999999), //A reference number, could be the payment id
'amount_of_payments' => 1,
'payment_amount' => 100 //the payment amount placed by the referred advocate
)
);
//trying to give a bonus to the advocate's referrer
$strResponse = $objGeniusReferralsAPIClient->postBonuses('my-store', $arrParams);
$intResponseCode = $objGeniusReferralsAPIClient->getResponseCode();
if($intResponseCode == 201){
// bonus given to the advocate's referrer
}
else{
// there is not need to give a bonus to the advocate's referrer
}