Retrieve churn reasons
Last updated: 23-Apr-2026
Rate this article:
Overview
Use the getChurnReasons method to retrieve all the churn reasons for a specific merchant with data in a specific language.
Parameters
| Parameters | 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
<?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.
[
{
"Code": "CHURN_REASON_NOT_SATISFIED_PRODUCT",
"Translation": "Not satisfied with the product/service"
},
{
"Code": "CHURN_REASON_PREFER_MANUAL",
"Translation": "Prefer to manually renew my subscription"
},
{
"Code": "CUSTOM_REASON_1",
"Translation": "Translation of custom reasons 1"
}
]
Rate this article: