Retrieve cross-sell campaign by code
Request parameters
Parameter
Type / Description
Request sample
<?php
declare(strict_types=1);
// Start clear CLI
echo chr(27).chr(91).'H'.chr(27).chr(91).'J';
// End clear CLI
$executionStartTime = microtime(true);
$apiVersion = '6.0';
$apiHost = "http://api.avangate.local";
$host = $apiHost."/soap/" . $apiVersion . "/";
$client = new SoapClient(
$host."?wsdl",
[\
'location' => $host,\
'trace' => 1,\
'cache_wsdl' => WSDL_CACHE_NONE\
]
);
$client->__setCookie('XDEBUG_SESSION', 'PHPSTORM');
// Please be aware to consider valid data
$merchantCode = 'your_merchant_code';
$key = 'your_merchant_key';
// Generate hash for login
$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("Generated sessionID: ". $sessionID);
echo "\n\r";
$crossSellCampaignCode = '2Xrl83J0k+qOr3W1ceTwZnHHr30=';
try {
$result = $client->getCrossSellCampaign($sessionID, $crossSellCampaignCode);
echo "\n\rGET CROSS SELL CAMPAIGNS: \n\r";
print_r(json_encode($result, JSON_PRETTY_PRINT));
} catch (SoapFault $e) {
echo $e->getMessage();
}
$executionEndTime = microtime(true);
// The duration will be displayed in seconds and milliseconds.
$seconds = round($executionEndTime - $executionStartTime, 2);
// Print it out
echo "\n\rThis script took $seconds to execute.\n\r";Response parameters
Parameter
Type
Last updated
Was this helpful?