Skip to main content
Vindicia Knowledge Center

Account.incrementTokens

Account.incrementTokens

Account.incrementTokens

The incrementTokens method adds the specified number of tokens to the Account object. Call this method to grant tokens (for example, virtual currency, frequent flier miles, or cell-phone minutes) to an Account object without conducting a formal CashBox transaction. Use this method to grant Tokens which will not be used as currency within CashBox.

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 to which to add tokens. Use the merchantAccountId or VID to identify the object.

tokenAmounts: an array of one or more TokenAmount objects, each of which specifies the type of token to add and its quantity. The quantity must be a positive number. Token types must exist before being used in incrementTokens.

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 a type of Token available to the Account after this call, and its balance (quantity) in the Account object, if the call succeeds. In some cases, this return might not occur, especially if you have not previously defined the specified token type.

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

 

Data Members

Data Type

Description

amount

Integer

The number of tokens.

Token

Token

The token type, which must be previously defined.

Returns

This method returns the codes listed in Standard Return Codes.

Example

// to increment tokens for an account

$acct = new Account();

// Reference an existing account to which the tokens are to be granted

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

// Refer to an existing token type using its id

$tok = new Token();
$tok->setMerchantTokenId("US_FREQ_BOOK_BUYER_PT");

// create a TokenAmount object and populate it with token type and
// quantity

$tokAmt = new TokenAmount();
$tokAmt->setToken($tok);
$tokAmt->setAmount(5); // award the Account with 5 tokens of this type

// Refer to another existing token type using its id

$tok2 = new Token();
$tok2->setMerchantTokenId("US_FREQ_DVD_BUYER_PT");

// create a TokenAmount object and populate it with token type and
// quantity

$tokAmt2 = new TokenAmount();
$tokAmt2->setToken($tok2);
$tokAmt2->setAmount(2); // award the Account with 2 tokens of this type

$tokAmounts = array($tokAmt, $tokAmt2);

// make the SOAP call to increment tokens

$response = $acct->incrementTokens($tokAmounts);

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

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

$newTokBalances = $response['tokenAmounts'];
foreach ($newTokBalances as $newTokBal) {

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

}

}

For Users

Learn More
For Users

Cashbox Features

Learn More
Cashbox Features
Back to Top