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

# Refund.fetchByTransaction

The `fetchByTransaction` method returns one or more `Refund` objects associated with the `Transaction` object specified in the input.

With Subscribe, you can issue multiple partial refunds against a `Transaction` as long as the amount of each refund is less than the `Transaction` amount, and the sum of all refunds does not exceed the `Transaction` amount.

If you are reporting refunds to Vindicia for chargeback processing only, multiple partial refunds may have been issued, and reported, against a single Transaction. Use this method to return all refunds listed against a specific Transaction.

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

*Transaction*: the `Transaction` object that serves as the search criterion. Identify this object with either its VID or your transaction ID (`merchantTransactionId`).

## Output

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

*refunds*: an array of one or more `Refund` objects associated with the `Transaction` object specified in the input.

## Returns

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

| Return Code | Return String |
| - | - |
| `400` | `No transaction specified to load by!` |
| `404` | `Unable to load refund: No match for transaction.` |

## Example

```

$txn = new Transaction();
$txn->setMerchantTransactionId('MRCH49229492');

$refund = new Refund();
$response = $refund->fetchByTransaction($txn);

if($response['returnCode'] == 200) {
   $fetchedRefunds = $response['data']->refunds;

   // process fetched refunds here
   if ($fetchedRefunds != null) {
      foreach ($fetchedRefunds as $fetchedRef) {
         // process a fetched refund here
         print "Refund VID " . $fetchedRef->getVID();
         print "Refund amount ". $fetchedRef->getAmount();
         print "Refund timestamp ". $fetchedRef->getTimestamp();
      }
   }
}
```

**Parent topic:**[Refund Methods](../topics/Refund_Methods)


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