Genius Referrals

HOW TO REGISTER NEW ADVOCATES

There are two different ways to register new advocates on Genius Referrals Platform when using AIM.

Check out the details here.
Using one of our SDKs is very easy and you can do it by calling the method postAdvocate(...) to register the new advocate and by calling the method patchAdvocate(...) to set the proper currency to the advocate. Below we show you an example.
Remember that every customer in your application represents an advocate in the Genius Referrals platform.
So you have to register all your customers in the Genius Referrals platform.
i
When registering new advocates you need to send the following parameters per each advocate:

  • Account Slug: The identifier for the account
  • Name: The name of the advocate
  • Last name: The last name of the advocate
  • Email: The email of the advocate
  • Payout Threshold: This represents the amount of bonuses the advocate has to generate before redeeming his bonuses.
There are mainly two ways to get the Account Slug parameter. You can get it from your account page on our Control Center or by using the SDK method get Accounts.
Avoiding sending personal data to genius referrals platform
If for security reasons you don't want to send your customers personal information to our platform, you can send references to the name, last name and email instead. Keep in mind that you must store these references locally on your application.
i
As an example, we are going to create the following advocate for the account 'My store' that we created previously.
  • Account Slug: my-store
  • Name: John
  • Last name: Smith
  • Email: john@email.com
  • Payout Threshold: 5
i
Using the Javascript SDK

We have several examples of how to implement this integration with Javascript here. So check it out if Javascript is your way to go.
i
Example using the PHP SDK:
Updating the advocate's currency
After registering and advocate you need to update the advocate's currency, otherwise, the advocate will not be able to receive bonuses.
i
Updating the advocate's currency

After registering and advocate you need to update the advocate's currency, otherwise, the advocate will not be able to receive bonuses.
Using the Example Applications

We also have two example applications where you can see the integration in action, download the sample applications here.
/*
     * On your action method just do something like this
     */
    
    // Create a new GRPHPAPIClient object 
    $objGeniusReferralsAPIClient = new GRPHPAPIClient('YOUR_USERNAME', 'YOUR_API_TOKEN');

    //preparing the data to be sent on the request
    $arrAdvocate = array(
        'advocate' => array(
            "name" => "Jonh", 
            "lastname" => "Smith", 
            "email" => "jonh@email.com", 
            "payout_threshold" => 5
            )
        );
    $objResponse = $objGeniusReferralsAPIClient->postAdvocate('my-store', $arrAdvocate);
    $intResponseCode = $objGeniusReferralsAPIClient->getResponseCode();
    // advocate successfully created
    if($intResponseCode == 201){
        //getting the advocate token from the Location header
        $arrLocation = $objResponse->getHeader('Location')->raw(); 
        $strLocation = $arrLocation[0];
        $arrParts = explode('/', $strLocation); 
        $strAdvocateToken = end($arrParts); 
        
        //Updating the advocate currency
        $arrParams = array('currency_code' =>  'USD'); 
        $objResponse = $objGeniusReferralsAPIClient->patchAdvocate('my-store', $strAdvocateToken, $arrParams); 
        $intResponseCode1 = $objGeniusReferralsAPIClient->getResponseCode();
        if($intResponseCode1 == 204){
            //currency successfully updated
            // TODO: Save the reference between the new advocate and the customer on your local database.
            // Use the $strAdvocateToken as a reference so that you can later use the method getAdvocate(...)
            // to retrive the advocate data.
        }
        else{
            // handle errors
        } 
        
    }
    else{
        // handle errors
    } 
Remember to replace the YOUR_USERNAME and YOUR_API_TOKEN by the ones generated for you.
Also, we have two sample application where you can see and integration in action.
Download this sample apps here
i
For more information about the Advocate, object review our RESTful API and our SDKs.