Retrieve an affiliate by code
Last updated: 27-Sep-2021
Rate this article:
Overview
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
<?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
Parameters | 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. |
ListName | Name of the affiliate commission list. |
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. |
FirstName | Affiliate first name. |
LastName | Affiliate last name. |
Phone | Affiliate phone number. |
Affiliate email. | |
Country | Country of the affiliate. |
Response Example
{
"AffiliateCode":"TFTF76455ee4YFCFCT6545465",
"Status":"Active",
"Affiliate Name":"STIC Soft E-Solutions Private Limited",
"Website":"https://debasis.2checkout.com",
"CommissionList": {
"ListName":"CommissionList1",
"CommissionRate":"25%"
},
"RequestDate":"2018-10-05",
"Categories":["PC security","Mobile security","Tablet security"],
"TCStatus":"Accepted",
"AffiliateContact":{
"FirstName":"FN",
"LastName":"LN",
"Phone":"0040723483987",
"Email":"FN.LN@2AFFLT.COM",
"Country":"Spain"
}
}
Rate this article: