getTransactionStatus
Retrieve the current status of a specific transaction.
Description
This method allows you to check the status of a completed transaction.
Use this method to determine if a transaction has been authorized, processed, or settled.
To specify the transaction you would like to view, you must retrieve it 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, voidTransaction, runCredit, runSale, runauthOnly, captureTransaction
Syntax
TransactionResponse getTransactionStatus ( 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. |
ReturnValue
Type | Description |
---|---|
TransactionResponse | Returns a TransactionResponse object containing the results of the transaction and all relevant data. |
Examples
PHP
For directions on how to set up the WSDL link, create "$token" and "$client", go to PHP Soap How-to.
<?php
try {
$refnum='1005312';
print_r($client->getTransactionStatus($token,$refnum));
}
catch(SoapFault $e) {
echo $e->getMessage();
}
echo "\n\nRequest: " . $tran->__getLastRequest();
echo "\n\nResponse: " . $tran->__getLastResponse();
?>
Java
This example uses the Newtek Gateway Java library. For directions on how to install the library and create the token/client objects, go to the Java JAX-WS Howto.
try {
//Set RefNum to the Reference Number of transaction you
//want to retrieve.
BigInteger refnum = new BigInteger();
TransactionResponse response = new TransactionResponse();
response = client.getTransactionStatus(token, refnum);
System.out.println(response.getStatus());
} catch (Exception e) {
System.out.println("Soap Exception: " + 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("982lz9VsLm87MA54Sv8E582h8OZMArL6", "443311")
Dim transaction As newtek.TransactionRequestObject = New newtek.TransactionRequestObject
Dim refnum As Integer
refnum = "46405618"
Dim response As newtek.TransactionResponse = New newtek.TransactionResponse
response = client.getTransactionStatus(token, refnum)
If response.StatusCode = "P" Then
MsgBox("Status: Pending")
ElseIf response.StatusCode = "B" Then
MsgBox("Status: Submitted")
ElseIf response.StatusCode = "E" Then
MsgBox("Status: Error, Reason: " & response.Error)
ElseIf response.StatusCode = "N" Then
MsgBox("Status: New Transaction")
ElseIf response.StatusCode = "F" Then
MsgBox("Status: Funded")
ElseIf response.StatusCode = "S" Then
MsgBox("Status: Settled")
ElseIf response.StatusCode = "V" Then
MsgBox("Status: Voided")
ElseIf response.StatusCode = "T" Then
MsgBox("Status: Timed Out (no response in 5 days)")
ElseIf response.StatusCode = "R" Then
MsgBox("Status: Returned")
ElseIf response.StatusCode = "M" Then
MsgBox("Status: On Hold")
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;
refnum = "46973526";
newtek.TransactionResponse response = new newtek.TransactionResponse();
try
{
response = client.getTransactionStatus(token, refnum);
if (response.StatusCode == "V") { MessageBox.Show(string.Concat("Status: Voided")); }
if (response.StatusCode == "B") {MessageBox.Show(string.Concat("Status: Submitted"));}
if (response.StatusCode == "E") {MessageBox.Show(string.Concat("Status: Error, Reason: " + response.Error));}
if (response.StatusCode == "N") {MessageBox.Show(string.Concat("Status: New transaction"));}
if (response.StatusCode == "F") {MessageBox.Show(string.Concat("Status: Funded"));}
if (response.StatusCode == "S") {MessageBox.Show(string.Concat("Status: Settled"));}
if (response.StatusCode == "P") {MessageBox.Show(string.Concat("Status: Pending"));}
if (response.StatusCode == "T") {MessageBox.Show(string.Concat("Status: Timed Out (no response in 5 days)"));}
if (response.StatusCode == "R") {MessageBox.Show(string.Concat("Status: Returned"));}
if (response.StatusCode == "M") { MessageBox.Show(string.Concat("Status: On hold")); }
}
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:getTransactionStatus>
<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">f000ea7855ed35226b1d1cb2b96a288d1069ddec</HashValue>
<Seed xsi:type="xsd:string">11587574150-test</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<RefNum xsi:type="xsd:string">102229960</RefNum>
</ns1:getTransactionStatus>
</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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getTransactionStatusResponse>
<getTransactionStatusReturn xsi:type="ns1:TransactionResponse">
<AcsUrl xsi:nil="true" />
<AuthAmount xsi:type="xsd:double">4</AuthAmount>
<AuthCode xsi:type="xsd:string">070963</AuthCode>
<AvsResult xsi:type="xsd:string">Address: Match & 5 Digit Zip: Match</AvsResult>
<AvsResultCode xsi:type="xsd:string">YYY</AvsResultCode>
<BatchNum xsi:type="xsd:string">1911</BatchNum>
<BatchRefNum xsi:type="xsd:string">198442</BatchRefNum>
<CardCodeResult xsi:type="xsd:string">Match</CardCodeResult>
<CardCodeResultCode xsi:type="xsd:string">M</CardCodeResultCode>
<CardLevelResult xsi:nil="true" />
<CardLevelResultCode xsi:nil="true" />
<ConversionRate xsi:type="xsd:double">0</ConversionRate>
<ConvertedAmount xsi:type="xsd:double">0</ConvertedAmount>
<ConvertedAmountCurrency xsi:type="xsd:string"></ConvertedAmountCurrency>
<CustNum xsi:type="xsd:string">0</CustNum>
<Error xsi:type="xsd:string">Approved</Error>
<ErrorCode xsi:type="xsd:integer">0</ErrorCode>
<isDuplicate xsi:type="xsd:boolean">false</isDuplicate>
<Payload xsi:nil="true" />
<RefNum xsi:type="xsd:string">102229960</RefNum>
<Result xsi:type="xsd:string">Approved</Result>
<ResultCode xsi:type="xsd:string">A</ResultCode>
<Status xsi:type="xsd:string">Pending</Status>
<StatusCode xsi:type="xsd:string">P</StatusCode>
<VpasResultCode xsi:nil="true" />
</getTransactionStatusReturn>
</ns1:getTransactionStatusResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Change Log
Version | Change |
---|---|
1.7 | TransKey can be used in RefNum field. |