developer:soap-1.1:methods:refundtransaction

refundTransaction

Refund a specific transaction.

Description

This method refunds a sale. Both credit card and check sale transactions may be refunded. You may choose to refund the entire amount or just a portion of the original sale.

For credit cards, the refund will show up as a separate transaction on the card holder's statement. To cancel the original sale before the batch it is in has been settled, the voidTransaction method should be used instead.

The transaction to be refunded must be retrieved using the reference number (RefNum) assigned to the transaction by the gateway. The RefNum is assigned by the gateway and returned when a transaction is processed. To find a missing RefNum, use the searchTransactions method.

See also runTransaction, voidTransaction

Syntax

TransactionResponse refundTransaction ( ueSecurityToken Token, integer RefNum, double Amount )

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and validate transaction.
integer RefNum Transaction Reference number assigned by the gateway.
double Amount Amount to be refunded (set to 0 if refunding entire original amount)

Return Value

TransactionResponse Returns a TransactionResponse object containing the results of the transaction and all relevant data.

.NET VB

Dim refnum As String
        Dim amount As String
        refnum = "47084726"
        amount = "10.00"
 
        Dim response As usaepay.TransactionResponse
        response = client.refundTransaction(token, refnum, amount)
 
        If response.ResultCode = "A" Then
            MsgBox("Transaction Refunded, Reference Number: " & response.RefNum)
        Else
            MsgBox("Transaction Error, Reason: " & response.Error)
        End If

.NET C#

string refnum;
            double amount;
 
            refnum = "47045250";
            amount = 1.00;
 
            usaepay.TransactionResponse response = new usaepay.TransactionResponse();
 
            try
            {
                response = client.refundTransaction(token, refnum, amount);
 
                if (response.ResultCode == "A")
                {
                    MessageBox.Show(string.Concat("Transaction Approved, RefNum: ",
                    response.RefNum));
                }
                else
                {
                    MessageBox.Show(string.Concat("Transaction Failed: ",
                    response.Error));
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
 
            }

Change History

Version Change
1.0 Method added in soap v1.0
developer/soap-1.1/methods/refundtransaction.txt · Last modified: 2010/10/21 12:00 by irina

Page Tools