Retrieve an affiliate by code

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

Request parameters

Parameter
Type / Description

AffiliateCode

Required (string) Unique code which represents an affiliate.

Request sample

<?php
$apiVersion = '6.0';
// $apiHost = "http://api.secure.avangate.local";
$apiHost = "http://api.sandbox34.avangate.local";

$host = $apiHost."/soap/" . $apiVersion . "/";

$client = new SoapClient($host."?wsdl", array('location' => $host, 'cache_wsdl' => WSDL_CACHE_NONE));
$client->__setCookie('XDEBUG_SESSION', 'PHPSTORM');

// $merchantCode = "AKULAJQW";
// $key = "P5LX&a&9=4Z)1!2L2*0N";

$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);

try {
    $sessionID = $client->login($merchantCode, $date, $hash);
} catch (SoapFault $e) {
    echo  $e->getMessage();

}

var_dump("session: ". $sessionID);

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

// Pending:
// 13639 - F56BCF1E2E

// Rejected
// 65602 - 79396127BA

try {
    $response = $client->getAffiliate($sessionID, $affiliateId);
    print_r(json_encode($response));

} catch (SoapFault $e) {
    echo  $e->getMessage();
}

// print_r($response);

Response parameters

Parameter
Description

AffiliateCode

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.

CommissionList.ListName

Name of the affiliate commission list.

CommissionList.CommissionRate

Value of the commission rate (in %).

RequestDate

Categories

Product category of the affiliate.

NotifyUpdates

Boolean. Value can be TRUE or FALSE.

TCSStatus

AffiliateContact

Affiliate contact details.

AffiliateContact.FirstName

Affiliate first name.

AffiliateContact.LastName

Affiliate last name.

AffiliateContact.Phone

Affiliate phone number.

AffiliateContact.Email

Affiliate email.

AffiliateContact.Country

Country of the affiliate.

Response sample

Last updated

Was this helpful?