// Do a refund transaction on the gateway
$transaction = $gateway->refund(array(
'amount' => '10.00',
'transactionReference' => $sale_id,
));
$response = $transaction->send();
if ($response->isSuccessful()) {
echo "Refund transaction was successful!\n";
$refund_id = $response->getTransactionReference();
echo "Transaction reference = " . $refund_id . "\n";
}