Giving bonuses to your advocates is very easy with Genius Referrals Platform, we have implemented API calls and methods that will make this process rather easy.

Normally, you will like to give a bonus to your advocates after one of his referrals has triggered action in your application, this can be a completed purchase, a successful referral, etc. Once you've identified the trigger action you should do something like the following to try to give the bonus to an advocate.


Before continuing, let's retake the example we were working with. In that example, we wanted to give an advocate's referrer (who is also an advocate) a bonus after one of his referred advocates has completed the first purchase.
Also, we have two sample applications where you can see integration in action. Download these sample apps here.
In other words, after an advocate has completed his first purchase, we need to try to give a bonus to his referrer. Here is an example of how you can give bonuses to your advocates.
So, our trigger action is this case will be "the completed first purchase".

Example using the PHP SDK:

     * 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
        // there is not need to give a bonus to the advocate's referrer
Remember to replace the YOUR_USERNAME and YOUR_API_TOKEN by the ones generated for you.
Sending the right parameters
You only need to send the advocate_token and the reference as mandatory parameters. The amount_of_payment and payment_amount are optional parameters and depend on the type and restriction that you've set on your campaign.