> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Transacting Purchases in Tokens

You may also decrement a customer’s token balance by conducting a transaction with the `TokenTransaction` object. Unlike the `Transaction` object, which works with both tokens and money (currency), `TokenTransaction` deals only with tokens. The advantage of using `TokenTransaction` over `Transaction` is that you need not define a token-based `BillingPlan` or `Product` object. Use `TokenTransaction` if you wish to take advantage of Subscribe’s token ledger for token accounting and record-keeping, but do not have `BillingPlan` objects explicitly priced in tokens, or do not want to browse transaction reports and make refunds on the Subscribe Portal.

Conduct multiple Token transactions, for multiple Token types, in a single call:

```

 /Create a new TokenTransaction object
 $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 token type that will be used 
 // 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 used with this transaction
  
 $tokTxn1->setTokenAmount($tokAmt1);
  
 $tokTxn1->setDescription("Purchase: Infinite Jest-Paperback");
  
 $tokTxn2 = new TokenTransaction();
  
 $tokTxn2->setAccount($acct);
 // Specify information about the tokens that will be used for this
 // transaction
 $tok2 = new Token();
 $tok2->setMerchantTokenId("US_FREQ_BOOK_BUYER_PT");
 $tokAmt2 = new TokenAmount();
 $tokAmt2->setToken($tok2);
 $tokAmt2->setAmount(3); // Number of tokens used with this transaction
  
 $tokTxn2->setTokenAmount($tokAmt2);
 $tokTxn2->setDescription("Purchase: Blink-Paperback");
 $tokTxns = array($tokTxn1, $tokTxn2);
  
 // make the SOAP call to perform the token transaction
 // Ensure that the Account set in each TokenTransaction object is 
 // the same object on which you make the following SOAP call 
  
 $response = $acct->tokenTransaction($tokTxns); 
  
 if($response['returnCode']==200) {
 // the call returns new token balances on the account.
 // print the new balances.
 $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";
 }
 }
```

**Parent topic:**[Decrementing Token Balances](../topics/Decrementing_Token_Balan)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.