VoidTransaction Method
Voids a transaction in the current batch.
Syntax
globalcharge.voidTransaction(PNRef, [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
A Void removes transactions from an open batch prior to settlement, to correct same-day transaction mistakes. A transaction can only be voided if it exists in the current open batch. To do so, call VoidTransaction with the PNRef parameter set to the PNRef of the original transaction. This only works for transactions that are still in the current open batch. If the batch that contained the target transaction has already been settled, you must use the Refund or Credit methods instead.
Note that since AuthOnly transactions are not added to the current batch, they cannot be voided. Examples follow.
class.CardNumber = "4444333322221111" class.CardExpMonth = 1 class.CardExpYear = 2015 class.TransactionAmount = "1.00" class.Sale() refNumToVoid = class.ResponsePNRef ... more sale transactions ... 'All that's needed for a void: class.VoidTransaction(refNumToVoid)