4D Payments SDK 2016 .NET Edition

Questions / Feedback?

VoidTransaction Method

Voids a transaction in the current batch.


public void VoidTransaction(string retrievalNumberToVoid, string lastRetrievalNumber);
Public Sub VoidTransaction(ByVal RetrievalNumberToVoid As String, ByVal LastRetrievalNumber As String)


This method voids a previously authorized transaction. A transaction can only be voided if it exists in the current open batch. If the batch that contained the target transaction has already been released (settled), you must use the Credit method instead.

The VoidTransaction method has two parameters, RetrievalNumberToVoid and LastRetrievalNumber. RetrievalNumberToVoid is the RetrievalNumber of the transaction you wish to void. LastRetrievalNumber should be set to the last RetrievalNumber received from the Paymentech Server. If LastRetrievalNumber is left blank, the current contents of the RetrievalNumber property will be used instead.

Before sending a void, you must make sure that the Number field contains the card number from the original transaction. Also note that since AuthOnly transactions are not added to the current batch, they cannot be voided. Examples follow.

component.Card = new CCCard("4444333322221111", 1, 2017)
component.TransactionAmount = "1.00"

cnumToVoid = component.Card.CardNumber
refNumToVoid = component.Response.RetrievalNumber

...  more sale transactions ...

'All that's needed for a void:
component.Card = new CCCard(cnumToVoid, -1, -1) 'Expiration date is ignored
component.VoidTransaction(refNumToVoid, "") 

Note that in the above void, if you use a new instance of the component or otherwise reset it's state, you must set the LastRetrievalNumber parameter as well.

Note: This method is not available when using the Terminal Capture SettlementMode.

.NET Standard Notes

To call this method in an asynchronous manner call VoidTransactionAsync instead. When the method completes (or an error is encountered) the VoidTransactionCompleted event will fire.

Copyright (c) 2021 4D Payments Inc. - All rights reserved.
4D Payments SDK 2016 .NET Edition - Version 16.0 [Build 7809]