getBatchTransactions

Retrieve transactions in the batch specified by BatchRefNum,

Description

This method will return all of the transactions contained within the specified batch. Use this method to retrieve all transaction data including status, type, amount, response and customer information. Please Note: This method can pull a maximum of 1000 transactions at a time. To pull more than 1000 batch transactions, use the searchTransactions method with the BatchID as a filter. Use the limit and start to break the batch into smaller segments so search will not time out..

See also: getBatchStatus, closeBatch, searchBatches.

Syntax

transactionObject[] getBatchTransactions ( ueSecurityToken Token, string BatchRefNum )

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and validate transaction.
string BatchRefNum A unique batch reference number assigned by the gateway.

Return Value

Type Description
transactionObject Returns an array of TransactionObjects for all transactions in the specified batch

Examples

PHP

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


    try {
      //Set BatchRefNum to the Batch Reference Number of the batch you want
      //to retrieve transactions from.  0 is always the current batch
      $BatchRefNum=0;

      $Result=$client->getBatchTransactions($token, $BatchRefNum);  
    }

    catch (SoapFault $e) {

      die("get Batch Transactions failed :" .$e->getMessage());

    }

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 BatchNum to the Batch Reference Number of the batch you want
      //to retrieve transactions from.  0 is always the current batch
      BigInteger BatchNum = new BigInteger("0");

      TransactionObjectArray ResultSet = new TransactionObjectArray();
      ResultSet = client.getBatchTransactions(token, BatchNum);
    } catch (Exception e) {
        System.out.println("Soap Exception: " + e.getMessage());
    }

Visual Basic (.Net)

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

    Dim BatchRefNum As String

    ' Set BatchRefNum to 0 to get the current batch.  
    ' Otherwise use batch reference num  (can be found in  Transaction.Details.BatchRefNum)
    BatchRefNum = "0"

    Dim transactions() As newtek.TransactionObject = client.getBatchTransactions(token, BatchRefNum)

    MsgBox("Found " & transactions.Length & " transactions in current batch")

.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 BatchRefNum = "9581";

                try
                {
                    newtek.TransactionObject[] tran = client.getBatchTransactions(token, BatchRefNum);

                    MessageBox.Show(string.Concat("Found ",tran.Length));

                }


                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:getBatchTransactions>
    <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">58ee8a7a846f692af341e187f06d47ffc75658f3</HashValue>
    <Seed xsi:type="xsd:string">11580947680-test</Seed>
    <Type xsi:type="xsd:string">sha1</Type>
    </PinHash>
    <SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
    </Token>
    <BatchRefNum xsi:type="xsd:string">201949</BatchRefNum>
    </ns1:getBatchTransactions>
    </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:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <ns1:getBatchTransactionsResponse>
    <getBatchTransactionsReturn
    SOAP-ENC:arrayType="ns1:TransactionObject[1]
    "xsi:type="ns1:TransactionObjectArray">
    <item xsi:type="ns1:TransactionObject">
    <AccountHolder xsi:type="xsd:string">Tester Jones</AccountHolder>
    <BillingAddress xsi:type="ns1:Address">
    <City xsi:type="xsd:string"></City>
    <Company xsi:type="xsd:string"></Company>
    <Country xsi:type="xsd:string"></Country>
    <Email xsi:type="xsd:string"></Email>
    <Fax xsi:type="xsd:string"></Fax>
    <FirstName xsi:type="xsd:string"></FirstName>
    <LastName xsi:type="xsd:string"></LastName>
    <Phone xsi:type="xsd:string"></Phone>
    <State xsi:type="xsd:string"></State>
    <Street xsi:type="xsd:string"></Street>
    <Street2 xsi:type="xsd:string"></Street2>
    <Zip xsi:type="xsd:string"></Zip>
    </BillingAddress>
    <CheckData xsi:type="ns1:CheckData">
    <Account xsi:nil="true" />
    <Routing xsi:nil="true" />
    </CheckData>
    <CheckTrace xsi:type="ns1:CheckTrace" />
    <ClientIP xsi:type="xsd:string"></ClientIP>
    <CreditCardData xsi:type="ns1:CreditCardData">
    <AvsStreet xsi:type="xsd:string">1234 Main Street</AvsStreet>
    <AvsZip xsi:type="xsd:string">99281</AvsZip>
    <CardCode xsi:type="xsd:string">XXX</CardCode>
    <CardExpiration xsi:type="xsd:string">XXXX</CardExpiration>
    <CardNumber xsi:type="xsd:string">XXXXXXXXXXXX7779</CardNumber>
    <CardPresent xsi:type="xsd:boolean">false</CardPresent>
    <CardType xsi:type="xsd:string">V</CardType>
    <InternalCardAuth xsi:type="xsd:boolean">false</InternalCardAuth>
    <MagStripe xsi:type="xsd:string"></MagStripe>
    <MagSupport xsi:type="xsd:string"></MagSupport>
    <Pares xsi:type="xsd:string"></Pares>
    <TermType xsi:type="xsd:string"></TermType>
    </CreditCardData>
    <CustomerID xsi:type="xsd:string"></CustomerID>
    <CustomFields SOAP-ENC:arrayType="ns1:FieldValue[0]"
    xsi:type="ns1:FieldValueArray" />
    <DateTime xsi:type="xsd:string">2016-01-26 16:51:35</DateTime>
    <Details xsi:type="ns1:TransactionDetail">
    <Amount xsi:type="xsd:double">132.85</Amount>
    <Clerk xsi:type="xsd:string"></Clerk>
    <Currency xsi:type="xsd:string"></Currency>
    <Description xsi:type="xsd:string">Example Transaction</Description>
    <Comments xsi:type="xsd:string"></Comments>
    <Discount xsi:type="xsd:double">0</Discount>
    <Invoice xsi:type="xsd:string">1692861458</Invoice>
    <NonTax xsi:type="xsd:boolean">false</NonTax>
    <OrderID xsi:type="xsd:string"></OrderID>
    <PONum xsi:type="xsd:string"></PONum>
    <Shipping xsi:type="xsd:double">0</Shipping>
    <Subtotal xsi:type="xsd:double">0</Subtotal>
    <Table xsi:type="xsd:string"></Table>
    <Tax xsi:type="xsd:double">0</Tax>
    <Terminal xsi:type="xsd:string"></Terminal>
    <Tip xsi:type="xsd:double">0</Tip>
    </Details>
    <LineItems SOAP-ENC:arrayType="ns1:LineItem[0]"
    xsi:type="ns1:LineItemArray" />
    <Response xsi:type="ns1:TransactionResponse">
    <AcsUrl xsi:nil="true" />
    <AuthAmount xsi:type="xsd:double">132.85</AuthAmount>
    <AuthCode xsi:type="xsd:string">320781</AuthCode>
    <AvsResult xsi:type="xsd:string">Address:Match &amp; 5 Digit Zip: Match
    </AvsResult>
    <AvsResultCode xsi:type="xsd:string">YYY</AvsResultCode>
    <BatchNum xsi:type="xsd:string">1</BatchNum>
    <BatchRefNum xsi:type="xsd:string">201949</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">103962985</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" />
    </Response>
    <ServerIP xsi:type="xsd:string">209.37.25.121</ServerIP>
    <ShippingAddress xsi:type="ns1:Address">
    <City xsi:type="xsd:string"></City>
    <Company xsi:type="xsd:string"></Company>
    <Country xsi:type="xsd:string"></Country>
    <Email xsi:type="xsd:string"></Email>
    <Fax xsi:type="xsd:string"></Fax>
    <FirstName xsi:type="xsd:string"></FirstName>
    <LastName xsi:type="xsd:string"></LastName>
    <Phone xsi:type="xsd:string"></Phone>
    <State xsi:type="xsd:string"></State>
    <Street xsi:type="xsd:string"></Street>
    <Street2 xsi:type="xsd:string"></Street2>
    <Zip xsi:type="xsd:string"></Zip>
    </ShippingAddress>
    <Source xsi:type="xsd:string">XML Trace Key</Source>
    <Status xsi:type="xsd:string">Authorized (Pending Settlement)</Status>
    <TransactionType xsi:type="xsd:string">Sale</TransactionType>
    <User xsi:type="xsd:string">auto</User>
    </item>
    </getBatchTransactionsReturn>
    </ns1:getBatchTransactionsResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

Change Log

Version Change
1.7 Changed BatchRefNum to type string