Skip to main content
Vindicia Knowledge Center

Transaction.fetchByMerchantTransactionId

Transaction.fetchByMerchantTransactionId

Transaction.fetchByMerchantTransactionId

The fetchByMerchantTransactionId method returns a Transaction object whose merchantTransactionId value matches the input. This ID could be assigned by you (for example, when you conduct a one-time transaction) or by CashBox while generating a rebilling transaction for an active AutoBill object.

Because Transactions change their status as they go through their life cycle in CashBox, returned Transaction objects might show a different status each time they are returned, especially for CashBox-processed transactions. The latest Transaction status is the first entry in the statusLog array (see the statusLog attribute in Transaction Data Members. For example, if you create a one-time transaction and call authCapture() on it, the latest transaction status is Authorized. Later, if you retrieve the same Transaction by its ID with this method, the latest status could be Captured.

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.

merchantTransactionId: the merchantTransactionId value, which serves as the search criterion.

Output

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

transaction: the Transaction object whose merchantTransactionId value matches the input.

Returns

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

Return Code

Return String

404

One of the following:

  • Unable to load transaction: No match for merchantTransactionId input-merchantTransactionId.
  • • Unable to load transaction by merchantTransactionId input-merchantTransactionId: error-description.

Example

// Known transaction id

$txId = "MERCH42202";

// create a transaction object to make the call

$soap_tx= new Transaction();

// fetch the record(s)

$response = $tx->fetchByMerchantTransactionId($txId);

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

$fetchedTx = $response['data']->transaction;

// process fetched transactions here

if ($fetchedTx != null) {

// process a fetched transaction here

print "Transaction VID " . $fetchedTx->getVID();
print "Transaction amount ". $fetchedTx->getAmount();
print "Transaction status ";
print $fetchedTx->statusLog[0]->status . "\n";

}

}

else if($response['returnCode'] == 404) {

print "No transaction found: ";
print $response['returnString'] . "\n";

}

For Users

Learn More
For Users

Cashbox Features

Learn More
Cashbox Features
Back to Top