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

# Transaction.fetchByVid

The `fetchByVid` method returns a `Transaction` object whose VID matches the input.

VID is Vindicia’s unique identifier for an object. While saving a `Transaction` object in its database for the first time after you’ve made a call (such as `migrate()`, `auth()`, or `authCapture()`), Subscribe generates and assigns a unique identifier for the object. Some calls return the newly created and updated `Transaction` object to you in their output response with the VID populated in the output `Transaction` object. Once you know a `Transaction` object’s VID, you may refer to that object by its VID in future calls.

Never assign a VID to a new `Transaction` object; Subscribe will generate the VID.

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

*vid*: the `Transaction` object’s Vindicia unique identifier, 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 VID matches the input.

## Returns

In addition to those listed in [The Return Object](The_Return_Object), this call returns:

| Return Code | Return String |
| - | - |
| `400` | `No VID specified to load transaction by.` |
| `404` | One of the following: - `Unable to load transaction: No match for VID *input-vid*.` - `Unable to load transaction by VID *input-vid: error-description*.` |

## Example

```

// Known VID
$vid = "29ed2ea9753896f980095911972d6695b049f54c";
 
// create a transaction object to make the call
$soap_tx= new Transaction();
 
// fetch the record(s)
$response = $tx->fetchByVid($vid);
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";
}
```

**Parent topic:**[Transaction Methods](../topics/Transaction_Methods)


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