Skip to main content
Vindicia Knowledge Center

Account.tokenTransaction

Account.tokenTransaction

Account.tokenTransaction

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.

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 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

authTimestamp

dateTime

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

clearedTimestamp

dateTime

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

description

string

Optional. A memo for the transaction.

tokenAmount

TokenAmount

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

Output

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.

Returns

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

Return Code

Return String

401

Balance too low.

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

404

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,

Example

$tokTxn1 = new TokenTransaction();

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

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

$tokTxn1->setAccount($acct);

// Specify information about the tokens for this transaction

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

$tokTxn1->setTokenAmount($tokAmt1);

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

$tokTxn2 = new TokenTransaction();

$tokTxn2->setAccount($acct);

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

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

$tokTxn2->setTokenAmount($tokAmt2);

$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

Cashbox Features

Learn More
Cashbox Features
Back to Top