/*
* On your action method just do something like this
*/
//the advocate token of the customer that wants to add a paypal account
$strGRAdvocateToken = '44ae47f4eda382a8f5830b78fedb7cf1de88981b0';
// Create a new GRPHPAPIClient object
$objGeniusReferralsAPIClient = new GRPHPAPIClient('YOUR_USERNAME', 'YOUR_API_TOKEN');
//preparing the data to be sent on the request
$arrParams = array(
'advocate_payment_method' => array(
'username' => 'john@mail.com',
'description' => 'Personal Paypal account',
'is_active' => true
)
);
//trying to create a new paypal account for the advocate
$strResponse = $objGeniusReferralsAPIClient->postAdvocatePaymentMethod('my-store', $strGRAdovocateToken, $arrParams);
$intResponseCode = $objGeniusReferralsAPIClient->getResponseCode();
if($intResponseCode == 201){
// Paypal account successfully created
}
else{
// handle errors
}
/*
* On your action method just do something like this
*/
//the advocate token of the customer that wants to redeem his bonuses
$strGRAdvocateToken = '44ae47f4eda382a8f5830b78fedb7cf1de88981b0';
// Create a new GRPHPAPIClient object
$objGeniusReferralsAPIClient = new GRPHPAPIClient('YOUR_USERNAME', 'YOUR_API_TOKEN');
//preparing the data to be sent on the request
$arrParams = array(
'redemption_request' => array(
'advocate_token' => $strGRAdovocateToken,
'request_status_slug' => 'requested',
'request_action_slug' => 'credit',
'currency_code' => 'USD',
'amount' => 50,
'description' => 'Redeeming as credit'
)
);
//trying to create a new redemption request for the advocate
$strResponse = $objGeniusReferralsAPIClient->postRedemptionRequest('my-store', $arrParams);
$intResponseCode = $objGeniusReferralsAPIClient->getResponseCode();
if($intResponseCode == 201){
// Redemption request successfully created
}
else{
// handle errors
}