Skip to main content

Retrieve an affiliate by code

Retrieve an affiliate by code

Last updated: 27-Sep-2021
Rate this article:


Use the getAffiliate method to extract details about an affiliate by code.

Request Parameters

Parameters Required Type/Description
AffiliateCode Required String. Unique code which represents an affiliate.

Request Example


function callRPC($Request, $hostUrl, $Debug = true)
    $curl = curl_init($hostUrl);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_SSLVERSION, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Accept: application/json',
    $RequestString = json_encode($Request);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);

    if ($Debug) {
    $ResponseString = curl_exec($curl);
    if ($Debug) {

    if (!empty($ResponseString)) {
//        var_dump($ResponseString);
        $Response = json_decode($ResponseString);
        if (isset($Response->result)) {
            return $Response->result;

        if (!is_null($Response->error)) {
            var_dump($Request->method, $Response->error);
    } else {
        return null;

$apiVersion = '6.0';
$host = "http://api.sandbox34.avangate.local/rpc/" . $apiVersion . "/";

$merchantCode = "lucian";
$key = "SECRET_KEY";

$date = gmdate('Y-m-d H:i:s');

$string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
$hash = hash_hmac('md5', $string, $key);

$i = 1; // counter for api calls
// call login
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = array($merchantCode, $date, $hash);
$jsonRpcRequest->id = $i++;

$sessionID = callRPC($jsonRpcRequest, $host);

$affiliateId = "79396127BA";
// Active:
// 1295 - 964CF2AF42
// 11541 - E4B69882C2
// 12951 - E8A1DB473C
// 12950 - 44857BFE94

// Pending:
// 13639 - F56BCF1E2E

// Rejected
// 65602 - 79396127BA

$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'getAffiliate';
$jsonRpcRequest->params = array($sessionID, $affiliateId);
$jsonRpcRequest->id = $i++;
echo "\nRESPONSE: \n\n";
$getAffiliate = callRPC($jsonRpcRequest, $host, false);


Response Parameters

Parameters Description


Unique, system-generated identifying code of the affiliate.
Status Merchant Affiliate relationship status.
AffiliateName Name of the affiliate.
Website Website of the affiliate.
CommissionList Affiliate commission list.
                                        ListName Name of the affiliate commission list.
                                        CommissionRate Value of the commission rate (in %).
Categories Product category  of the affiliate.
NotifyUpdates Boolean. Value can be TRUE or FALSE.
AffiliateContact Affiliate contact details.
                                         FirstName Affiliate first name.
                                         LastName Affiliate last name.
                                        Phone Affiliate phone number.
                                        Email Affiliate email.
                                        Country Country of the affiliate.

Response Example

   "Affiliate Name":"STIC Soft E-Solutions Private Limited",
   "CommissionList":  {  
   "Categories":["PC security","Mobile security","Tablet security"],


Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo