Refund Method
Refunds a previously captured transaction.
Syntax
icharge.refund(transactionId, refundAmount, [callback])
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for this method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
This method refunds a transaction that has already been captured, or settled. If the transaction is still outstanding use the VoidTransaction method instead. The TransactionId parameter indicates to the Gateway which transaction is to be refunded, and should contain the ResponseTransactionId from the original transaction. The RefundAmount parameter is the value to be refunded back to the customer, and can be all or part of the original TransactionAmount
Please see the gateway information in the table of contents to determine if your gateway supports Refund transactions.
The gw3DSI gateway requires the following additional fields for Refund transactions:
class.AddSpecialField "UserId", "my 3DSI-assigned UserId" '(Different than MerchantLogin) class.MerchantPassword = "my 3DSI-assigned Pwd"
The LinkPoint and PSIGateXML gateways require you send the ResponseInvoiceNumber rather than the ResponseTransactionId.