For the complete documentation index, see llms.txt. This page is also available as Markdown.

Retrieve churn reasons

Use the getChurnReasons method to retrieve all the churn reasons for a specific merchant with data in a specific language.

Request parameters

Parameter
Type / Description

sessionID

Required (string) Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect.

The sessionID expires in 10 minutes.

Language

Required (string) The language abbreviation in which messages are translated.

Request sample

<?php

$apiVersion = '6.0'; 
$host = "http://api.avangate.local:8081/soap/".$apiVersion."/"; 
$client = new SoapClient($host."?wsdl", array('location' => $host, 'cache_wsdl' => WSDL_CACHE_NONE)); 
$client->__setCookie('XDEBUG_SESSION', 'PHPSTORM'); 
$merchantCode = "124231873235"; 
$key = "%&7+J[Q7T!B!1(z1e7&a"; 
$date = gmdate('Y-m-d H:i:s'); 
$string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
$hash = hash_hmac('md5', $string, $key); 
try {
    echo "login \r\n"; 
    $sessionID = $client->login($merchantCode, $date, $hash); 
} catch (SoapFault $e) { 
    echo  $e->getMessage();
} 
print_r("session: ". $sessionID); 

$language = 'en'; 

try {
    $churnReasons = $client->getChurnReasons($sessionID, $language);
} 
catch (SoapFault $e) {
    echo "churn reasons: " . $e->getMessage();
    exit;
}
var_dump("churn reasons", $churnReasons);

Response

An array of churn reason objects, made of country code and translation.

Last updated

Was this helpful?