Service: GetBalance

The GetBalance returns the number of Email, Fax and SMS credits available for the given account.

Service Details

SOAP Action: GetBalance
SOAP Return Object: GetBalanceResp

Input

The following table describes the parameters used for calling the GetBalance service.

Table: instance of GetBalanceReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication

Output

The following table describes the parameters returned from the GetBalance service.

Table: instance of GetBalanceResp

Parameter Mandatory Type Description
header / APIResponseHeader Header containing authentication information
errorCode / Integer Numerical value of the error
errorMessage / String Short literal description of the error
email / Integer Email credits available
fax / Integer Fax credits available
sms / Integer SMS credits available

Table: response codes of GetBalanceResp

0 No error
220 Authentication error, see header object for detailed information

Example

This examples show the request of the balance of an account.
<?php
// Request the user's email credits balance
$header->userId = USER_ID;
$header->userToken = USER_TOKEN;

$getBalanceReq->header = $header;
$getBalanceResp = $SoapClient->__soapCall("GetBalance", array($getBalanceReq));

if ($getBalanceResp->ErrorCode == 0) {
	echo "Credits available: " . $getBalanceResp->email;
} else {
	echo "Balances could not be retrieved: " . $getBalanceResp->errorMessage;
}
?>