Skip to main content
Vindicia Knowledge Center

Account.tokenBalance

Account.tokenBalance

Account.tokenBalance

The tokenBalance method returns the balance of tokens of the specified type in the Account object. If you do not specify the token type, the call returns the balance of all the tokens currently available to the account.

Input

srd: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a method call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the srd. A null srd returns the complete response.

account: the Account object whose token balance you wish to return. Use the merchantAccountId or VID to identify the object.

tokens: an array of one or more token types, whose balance you wish to return. If you do not specify a type, tokenBalance returns the balance for all the types available to the Account object.

Output

return: an object of type Return that indicates the success or failure of the call.

tokenAmounts: an array of one or more TokenAmount objects, each of which specifies the type of token, its quantity, and the balance of the tokens that are available to the Account object. If you do not specify a token type in the input, this array contains the balance of all token types available to the Account. Otherwise, this array contains the balances of only the specified token types.

Returns

This method returns the codes listed in Standard Return Codes.

Example

$acct = new Account();

// Reference an existing account from which tokens are to be deducted

$acct = new Account();
$acct->setMerchantAccountId('9876-5432');

// make the SOAP call to retrieve tokens

$response = $acct->tokenBalances(null);

// return balances for all token types

if($response['returnCode']==200) {

// the call returns new token balances on the account
// print those out

$tokBalances = $response['tokenAmounts'];
foreach ($tokBalances as $tokBal) {

print "Token type" . $tokBal->token->merchantTokenId . "\n";
print "Token amount available" . $tokBal->amount . "\n";

}

}

For Users

Learn More
For Users

Cashbox Features

Learn More
Cashbox Features
Back to Top