searchTransactions

Search transactions and return full transaction records.

Description

This method allows you to find transactions even if you have misplaced or can't remember the transaction's RefNum (a unique number assigned to each transaction by the gateway).

Please Note: When merchant is configured for merchant scoped Transactions IDs, system scoped transactions will not be returned by the searchTransactions method.

The following fields may be used to search the database and return transaction details:

  • TransID
  • BatchID
  • Type
  • Status
  • Response
  • AuthCode
  • AvsResult
  • CvcResult
  • Reason
  • ErrorCode
  • Created
  • CreateTime
  • Invoice
  • OrderID
  • PoNum
  • CustID
  • RecCustID
  • Description
  • Amount
  • Currency
  • RawAmount
  • Tax
  • Tip
  • Shipping
  • Discount
  • Subtotal
  • Cardholder
  • CCNum (the CCNum can also be replaced by a token if the card has been tokenized)
  • CCNum4First
  • AvsStreet
  • AvsZip
  • User
  • Clerk
  • TranTerm
  • Rest_Table
  • Sources.Name
  • ServerIP
  • ClientIP
  • CheckNum
  • VCAccount
  • VCRouting
  • VCChecks.Effective
  • VCChecks.Settled
  • VCChecks.Processed
  • Returned
  • VCChecks.Banknote
  • Billing_FName
  • Billing_LName
  • Billing_Company
  • Billing_Street
  • Billing_Street2
  • Billing_City
  • Billing_State
  • Billing_Zip
  • Billing_Country
  • Billing_Phone
  • Email
  • Fax
  • Website
  • Shipping_FName
  • Shipping_LName
  • Shipping_Company
  • Shipping_Street
  • Shipping_Street2
  • Shipping_City
  • Shipping_State
  • Shipping_Zip
  • Shipping_Country
  • Shipping_Phone

See also searchTransactionsCustom and searchTransactionsCount

Syntax

TransactionSearchResult searchTransactions ( ueSecurityToken Token, SearchParam Search, boolean MatchAll, integer Start, integer Limit, string Sort)

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and validate transaction.
SearchParam Search Array of search parameters (SearchParam objects) available.
boolean MatchAll If set to "true," only results matching all search criteria will be returned, if set to "false," results matching any of the search criteria will be returned.
integer Start Record number to start returning from (ie if 1,000 were found and you only want to receive the last 200 you would set Start=800 and Limit=200)
integer Limit Maximum number of transactions to return in result set.
string Sort Comma separated list of fields to sort by.

Return Value

Type Description
TransactionSearchResult Returns the full transaction records for all transactions matching the specified search parameters.

Examples

PHP 5

For directions on how to set up the WSDL link, create "$token" and "$client", go to PHP Soap How-to.


    <?php

    try {

      // Create search parameter list
      $search=array(
        array(
          'Field'=>'amount',   
          'Type'=>'eq',
          'Value'=>'4.00'),
        array(
          'Field'=>'created',  
          'Type'=>'gt',  
          'Value'=>'2007-03-21'),
        array(
          'Field'=>'created',  
          'Type'=>'lt',  
          'Value'=>'2007-03-22'),
        array(
          'Field'=>'response',  
          'Type'=>'eq',  
          'Value'=>'A')
        );
      $start=0;
      $limit=100;
      $matchall=true;
      $sort='created';

      $res=$client->searchTransactions($token,$search,$matchall,$start,$limit,$sort);

      print_r($res);

    }
    catch(SoapFault $e) {
      echo $client->__getLastResponse();
      die("Search Transaction Failed :".$e->getMessage());
    }

    ?>

PHP 4 (NuSOAP)

    <?php

    include './nusoap.php';

    // Create Soap Client
    $s=new soapclient("./newtek.wsdl",'wsdl');
    $tran=$s->getProxy();

    // Source Key Setting
    $sourcekey='yQbOFkjD8wwlkZ3AhY248k3Lc9PH1l14';
    $pin='1234';

    // Prep source key
    $seed=mktime() . rand();
    $tmp=$sourcekey . $seed . $pin;
    $hash=sha1($tmp);
    $token=array('SourceKey'=>$sourcekey, 'PinHash'=>array('Type'=>'sha1', 'Seed'=>$seed,'HashValue'=>$hash));


    // Prep Request data
    $search=array(
          array('Field'=>'amount', 'Type'=>'gt','Value'=>'5.00'),
          array('Field'=>'created', 'Type'=>'gt', 'Value'=>'2005-01-01'),
          array('Field'=>'response', 'Type'=>'eq', 'Value'=>'A')
    );
    $start=0;
    $limit=10;
    $matchall=true;
    $sort='created';

    $res=$tran->searchTransactions($token,$search,$matchall,$start,$limit,$sort);

    if(!$err=$tran->getError()) {
            print_r($res);
    } else {

            echo "Error: $err\n";
            echo $tran->request;  

    }

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 MatchAll As Boolean

            MatchAll = False

            Dim searchParams(1) As newtek.SearchParam
            searchParams(0) = New newtek.SearchParam
            searchParams(0).Field = "Created"
            searchParams(0).Type = "eq"
            searchParams(0).Value = "2009-02-19"

            Dim start As Integer

            start = 1

            Dim limit As Integer

            limit = "999999"

            Dim SearchResults As newtek.TransactionSearchResult = New newtek.TransactionSearchResult
            SearchResults = client.searchTransactions(token, searchParams, MatchAll, 0, 1000, "")

            MsgBox(SearchResults.TransactionsMatched)

.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.

    Boolean matchAll;
    matchAll = true;

    String startTransID = "1234";


    newtek.SearchParam[] search = new newtek.SearchParam[2];
    search[0] = new newtek.SearchParam();
    search[1] = new newtek.SearchParam();

    search[0].Field = "Response";
    search[0].Type = "eq";
    search[0].Value = "A";

    search[1].Field = "TransID";
    search[1].Type = "gt";
    search[1].Value = startTransID;

    newtek.TransactionSearchResult result = new newtek.TransactionSearchResult();

    int pos = 0;
    int limit = 10;  // size of result set
    int totalFound =0;

    try
    {

        // loop through result sets
        do
        {
            result = client.searchTransactions(token, search, matchAll,
                  pos.ToString(), limit.ToString(), "TransID");

            // Perform operations on returned data
            MessageBox.Show(string.Concat("Retrieved ", pos, " to ",
                  pos + Convert.ToInt32(result.TransactionsReturned),
                  " of ", result.TransactionsMatched));


            pos += limit;
            if (totalFound == 0) totalFound = Convert.ToInt32(result.TransactionsMatched);


        } while (pos< totalFound);


    }


    catch (Exception err)
    {
        MessageBox.Show(err.Message);
    }

Coldfusion

NOTE: this example has not been tested and is provided as is

    Start = 0;
    Limit = 10;
    MatchAll=1;
    Sort='created';
    Search=ArrayNew(1);
    Search[1]=structnew();
    Search[1].Field='created';
    Search[1].Type='gt';
    Search[1].Value='2006-09-01';

    ws = createObject("webservice", "https://secure.newtekgateway.com/soap/gate/3213EA2A/newtek.wsdl");
    Output = ws.searchTransactions(Token, Search, MatchAll, Start, Limit, Sort);

XML

    <?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:searchTransactions>
    <Token xsi:type="ns1:ueSecurityToken">
    <ClientIP xsi:type="xsd:string">192.168.0.1</ClientIP>
    <PinHash xsi:type="ns1:ueHash">
    <HashValue xsi:type="xsd:string">11ac55b0a0b59f8f028dbf85bc32266fa973dd0e</HashValue>
    <Seed xsi:type="xsd:string">12678150211876663375</Seed>
    <Type xsi:type="xsd:string">sha1</Type>
    </PinHash>
    <SourceKey xsi:type="xsd:string">HB4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
    </Token>
    <Search SOAP-ENC:arrayType="ns1:SearchParam[1]" xsi:type="ns1:SearchParamArray">
    <item xsi:type="ns1:SearchParam">
    <Field xsi:type="xsd:string">amount</Field>
    <Type xsi:type="xsd:string">eq</Type>
    <Value xsi:type="xsd:string">29.00</Value>
    </item>
    </Search>
    <MatchAll xsi:type="xsd:boolean">true</MatchAll>
    <Start xsi:type="xsd:integer">0</Start>
    <Limit xsi:type="xsd:integer">10</Limit>
    <Sort xsi:type="xsd:string">created</Sort>
    </ns1:searchTransactions>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

Change History

Date Versions Change
2018/01/09 1.4 - 1.7+ Added the ability to search by a cards payment method.
2018/05/01 1.4 - 1.7+ Corrected Parameter name from VCChecks.Returned to Returned.