voidTransaction
Void a specific transaction.
Description
This function will void a transaction that was previously authorized. Once a transaction has been voided, it will not show up on the customer's credit card statement. Customers who have online banking that allows them to see "Pending" transactions may see the voided transaction for a few days before it disappears.
You can only void a transaction that hasn't been settled yet. A transaction is settled when the batch that it is in has been closed. If the transaction has been settled, you must run a credit instead using the runCredit method. If you run a credit, both the credit and the initial charge will show up on the customer's credit card statement. (See the runCredit method for more details.)
The transaction to be voided 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, runQuickSale, runCredit, runSale, runauthOnly, getTransactionStatus
Syntax
boolean voidTransaction ( ueSecurityToken Token, string RefNum )
Arguments
Type | Name | Description |
---|---|---|
ueSecurityToken | Token | Merchant security token: used to identify merchant and validate transaction. |
string | RefNum | Unique transaction reference number assigned by the gateway. You can also use TransKey in the RefNum field. |
Return Value
Type | Description |
---|---|
boolean | Returns confirmation of request only if successful. If request fails, an exception will be thrown. |
Examples
PHP
For directions on how to set up the WSDL link, create "$token" and "$client", go to PHP Soap How-to.
<?php
try {
$Request=array(
'AccountHolder' => 'Tester Jones',
'Command' => 'authonly',
'Details' => array(
'Description' => 'Example Transaction',
'Amount' => '4.00',
'Invoice' => '44539'
),
'CreditCardData' => array(
'CardNumber' => '4444555566667779',
'CardExpiration' => '0919',
'AvsStreet' => '1234 Main Street',
'AvsZip' => '99281',
'CardCode' => '999'
)
);
$temp=$client->runTransaction($token, $Request);
$res=$client->voidTransaction($token,$temp->RefNum);
print_r($res);
}
catch (SoapFault $e) {
die("Void Transaction failed :" .$e->getMessage());
}
?>
VB
For directions on how to set up the WSDL link and create the "token" and "client" variables, go to the Visual Basic .Net Soap How-to.
Dim client As newtek.newtekService = New newtek.newtekService
Dim token As newtek.ueSecurityToken
token = Me.CreateToken("714SSUxv1uohng2XkMJ7kLpETsu58G66", "1234")
Dim transaction As newtek.TransactionRequestObject = New newtek.TransactionRequestObject
Dim refnum As String
Dim void As Boolean
refnum = "46980114"
void = True
Dim result As Boolean
result = client.voidTransaction(token, refnum)
If result = True Then
MsgBox("Transaction Voided")
Else
MsgBox("An error occured.")
End If
.NET C
For directions on how to set up the WSDL link and create the "token" and "client" variables, go to the C Sharp .Net Soap How-to.
string refnum;
Boolean response;
refnum = "46973526";
try
{
response = client.voidTransaction(token, refnum);
if (response == true)
{
MessageBox.Show(string.Concat("Transaction voided"));
}
else
{
MessageBox.Show(string.Concat("An error occured"));
}
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
XML
Request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:newtek"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:voidTransaction>
<Token xsi:type="ns1:ueSecurityToken">
<ClientIP xsi:type="xsd:string">123.123.123.123</ClientIP>
<PinHash xsi:type="ns1:ueHash">
<HashValue xsi:type="xsd:string">aece31e8de6306a0ba601939813554b7351470ef</HashValue>
<Seed xsi:type="xsd:string">11333566304-test</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT
</SourceKey>
</Token>
<RefNum xsi:type="xsd:string">102229369</RefNum>
</ns1:voidTransaction>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Response:
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns1="urn:newtek"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:voidTransactionResponse>
<voidTransactionReturn xsi:type="xsd:boolean">true</voidTransactionReturn>
</ns1:voidTransactionResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Change Log
Version | Change |
---|---|
1.7 | TransKey can be used in RefNum field. |