Skip to main content
Vindicia Knowledge Center




The tokenTransaction method performs one or more token transactions, of multiple token types, on an Account object. The transactions may be positive, increasing the token balance; or negative, reducing the token balance.

Calling tokenTransaction enables you to conduct a lightweight transaction with only tokens. Although Vindicia’s internal token system tracks this type of transaction for audit logging, they are not a part of Vindicia’s standard transaction framework for money-based transactions.


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 for which to perform the transaction. Use the merchantAccountId or VID to identify the object.

transactions: an array of one or more TokenTransaction objects to perform against the Account object. Each TokenTransaction object specifies the type of token and the quantity to increment or decrement from the object.

The following table lists and describes the data members of the TokenTransaction object.

Data Members

Data Type

Data Members



A time stamp that specifies the date and time of when you processed the transaction. Insert this data with your code.



A time stamp that specifies the date and time of when Vindicia processed the transaction. Vindicia Subscribe inserts this data.



Optional. A memo for the transaction.



Required. An enumerated string value that categorizes the type of account activity you are recording.


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

tokenAmounts: an array of TokenAmount objects, each of which contains the new balance and the token type available to the Account object after this call succeeds.


In addition to those listed in Standard Return Codes, this call returns:

Return Code

Return String


Balance too low.

Returned if one or more transactions requested would drop the user's balance below 0.


Token not found.

Returned if one or more tokens specified are not a saved type; however, the tokens available on the account are still returned,


$tokTxn1 = new TokenTransaction();

// Reference an existing account to which this transaction is to be
// applied

$acct = new Account();


// Specify information about the tokens for this transaction

$tok1 = new Token();
$tokAmt1 = new TokenAmount();
$tokAmt1->setAmount(4); // Number of tokens spent with this transaction


$tokTxn1->setDescription("Purchase: Stranger in a Strange Land");

$tokTxn2 = new TokenTransaction();


// Information about the tokens that will pay for the transaction

$tok2 = new Token();
$tokAmt2 = new TokenAmount();
$tokAmt2->setAmount(3); // Number of tokens for the transaction


$tokTxn2->setDescription("Purchase: Infinite Jest");

$tokTxns = array($tokTxn1, $tokTxn2);

// Make the SOAP call to perform the token transactions
// Ensure that account set in each TokenTransaction object is
// the same Account object on which you make the following SOAP call

$response = $acct->tokenTransaction($tokTxns);

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

// print the new token balances on the account

$newTokBalances = $response['tokenAmounts'];

print "New token balances for account with id "

. $acct>merchantAccountId . "\n";

foreach ($newTokBalances as $newTokBal) {

print "Token type"

. $newTokenBal->token->merchantTokenId; . "\n";

print "Token amount available" . $newTokenBal->amount; . "\n";



For Users

Learn More
For Users

Vindicia Subscribe Features

Learn More
Vindicia Subscribe Features
Back to Top