VoidTransaction Method
Voids a transaction in the current batch.
Syntax
ptechgiftcard.voidTransaction(retrievalNumberToVoid, lastRetrievalNumber, [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 stored value Void transaction allows the removal of a transaction from the open batch in the terminal. The void will communicate to the stored value host so that the host can reverse the requested stored value transaction.
The VoidTransaction method has two parameters, RetrievalNumberToVoid and LastRetrievalNumber. RetrievalNumberToVoid is the ResponseRetrievalNumber of the transaction you wish to void. LastRetrievalNumber should be set to the last ResponseRetrievalNumber received from the Paymentech Server. If LastRetrievalNumber is left blank, the contents of the ResponseRetrievalNumber property will be used instead.
Before sending a void, you must make sure that the CardNumber property contains the card number from the original transaction. For example:
class.CardNumber = "4444333322221111" class.CardExpMonth = 1 class.CardExpYear = 2010 class.TransactionAmount = "1.00" class.RedeemCard() cnumToVoid = class.CardNumber refNumToVoid = class.ResponseRetrievalNumber ... more sale transactions ... 'All that's needed for a void: class.SequenceNumber = class.SequenceNumber + 1 class.CardNumber = cnumToVoid class.VoidTransaction(refNumToVoid, class.ResponseRetrievalNumber)
In the above void, if you use a new instance of the class or otherwise reset it's state, you must set the LastRetrievalNumber parameter as well.
Note: Voids cannot be performed on BalanceInquiry or Forced transactions.