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

# refundTransactions

Directs Vindicia Retain to discontinue further attempts to capture a transaction, or to refund a captured transaction. A call to `refundTransactions` might be needed when a customer has canceled a subscription, or has separately paid a bill independent of Retain processing. This call results in Retain either ceasing attempts (retries) to capture a submitted failed transaction, or refunding a Retrain transaction that has already been captured.

If a submitted refund transaction fails to Retain input validation it is returned in the response array, along with information indicating the issue.

After Retain processes the `refundTransactions` call, a call to `fetchBillingResults` for the datetime range in which the refundTransactions was performed, or to `fetchByMerchantTransactionId`, will return details of the `refundTransactions` operation for applicable transactions.

## Input

*refunds*: an array of `merchantTransactionIds` and optional `amounts` to refund/cancel. If amount is not specified, Retain will attempt to refund the total amount of the specified Transaction.

**Note:** Use of the optional `amount` field is discouraged. If the value is less than the total amount of the originally submitted failed transaction then a partial refund can be processed but future retries will still be discontinued. Any future refunds will have to specify the precise, remaining balance (original, submitted transaction amount minus any partial refunds that have been performed) in order to pass input validation.

## Output

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

*response*: an object of type [`TransactionValidationResponse`](TransactionValidationResponse), which includes the `merchantTransactionID` of each transaction that returned an error.

**Note:** An empty `TransactionValidationResponse` object indicates that the call succeeded without error. For more information, see [TransactionValidationResponse Values](TransactionValidationResponse).

## Returns

This method returns the codes listed in [Retain Return Codes](retain.return_codes).

## Example

```

//Given existing (i.e. already billed)
//merchantTransactionIds TxPrfx123, TxPrfx234, and TxPrfx345:
$select = new select();
$ret = $select->refundTransactions(array{'TxPrfx123', 'TxPrfx234',
'TxPrfx345'});
if($ret['returnCode'] == 200)
{
    $failedTransactions = $ret['response'];
    if($failedTransactions && (sizeof($failedTransactions) > 0))
    {
        foreach ($failedTransactions as $transaction)
        {
            //Evaluate Transaction failure response here
        }
    }
}
else
{
    //Handle error condition.
}
```

**Parent topic:**[Vindicia Retain Methods](../topics/vindicia_retain_methods)


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