SearchInvoices

Description

This method allows users to search the invoices on the basis of Invoice number, Customer Id, and Search filters, as an array.

Syntax

Invoice [] SearchInvoices( SecurityToken securityToken, string customerId, string subCustomerId, string invoiceNumber, string invoiceInternalId, SearchFilter [] filters, int start, int limit, string sort, bool includeItems);

Arguments

TypeNameDescription
SecurityToken securityTokenMerchant security token: used to identify merchant and validate transaction. (required)
stringcustomerIdCustomer ID. (required)
stringsubCustomerIdSub-customer ID. (optional)
stringinvoiceNumberInvoice number. (required)
stringinvoiceInternalIdUnique invoice ID assigned by the internal system. (required)
SearchFilterfiltersTo filter returned results. (required)
intstartStart position, defaults to 0 (first item found). (required)
intlimitMaximum number of items to return in result. (required)
stringsortField name to sort the results by. (optional)

Return Value

Invoice []Returns an array of invoices matching the specified search parameters.

Examples

function searchInvoices()
{
    $client = new SoapClient('End point URL');
    $securityToken = array(
        'SecurityId' => '********-454757-********-********',
        'UserId' => 'merchant1',
        'Password' => 'merchant1'
    );
    $searchFilters['SearchFilter'][0] = array(
        'FieldName' => 'InvoiceDueDate',
        'ComparisonOperator' => 'ge',
        'FieldValue' => '2021-01-25'
    );
    $searchInvoices = $client->SearchInvoices(array(
        'securityToken' => $securityToken,
        'customerId' => '123',
        'invoiceNumber' => '00102566',
        'filters' => $searchFilters,
        'start' => 0,
        'limit' => 10,
     ));
    $invoices = $searchInvoices->SearchInvoicesResult;
}
Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
   <soapenv:Header/>
   <soapenv:Body>
      <ebiz:SearchInvoices>
         <ebiz:securityTokenCustomer>
            <ebiz:SecurityId>********-90b4-4a38-ad78-********</ebiz:SecurityId>
            <ebiz:UserId/>
            <ebiz:Password/>
         </ebiz:securityTokenCustomer>
         <ebiz:customerId/>
         <ebiz:subCustomerId/>
         <ebiz:invoiceNumber/>
         <ebiz:invoiceInternalId/>
         <ebiz:filters>
            <ebiz:SearchFilter>
               <ebiz:FieldName>InvoiceDueDate</ebiz:FieldName>
               <ebiz:ComparisonOperator>ge</ebiz:ComparisonOperator>
               <ebiz:FieldValue>2015-11-25</ebiz:FieldValue>
            </ebiz:SearchFilter>
            <ebiz:SearchFilter>
               <ebiz:FieldName>InvoiceDueDate</ebiz:FieldName>
               <ebiz:ComparisonOperator>le</ebiz:ComparisonOperator>
               <ebiz:FieldValue>2017-11-26</ebiz:FieldValue>
            </ebiz:SearchFilter>
            <ebiz:SearchFilter>
               <ebiz:FieldName>InvoiceAmount</ebiz:FieldName>
               <ebiz:ComparisonOperator>eq</ebiz:ComparisonOperator>
               <ebiz:FieldValue>1000.00</ebiz:FieldValue>
            </ebiz:SearchFilter>
         </ebiz:filters>
         <ebiz:start>1</ebiz:start>
         <ebiz:limit>3</ebiz:limit>
         <ebiz:sort/>
         <ebiz:includeItems>false</ebiz:includeItems>
      </ebiz:SearchInvoices>
   </soapenv:Body>
</soapenv:Envelope>


Response:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <SearchInvoicesResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <SearchInvoicesResult>
            <Invoice>
               <CustomerId>CBS</CustomerId>
               <SubCustomerId></SubCustomerId>
               <InvoiceNumber>Inv1-103</InvoiceNumber>
               <InvoiceInternalId>********-1442-4645-8f89-********</InvoiceInternalId>
               <InvoiceDate>2017-01-01</InvoiceDate>
               <Currency>USD</Currency>
               <InvoiceAmount>1000.0000</InvoiceAmount>
               <InvoiceDueDate>2016-04-02</InvoiceDueDate>
               <AmountDue>5.0000</AmountDue>
               <PoNum>PO001</PoNum>
               <SoNum>SO001</SoNum>
               <DivisionId>0001</DivisionId>
               <Software>QuickBooks</Software>
               <NotifyCustomer>false</NotifyCustomer>
               <InvoiceURL>https://www.ebizcharge.net/uploads/invoice001.pdf</InvoiceURL>
               <TotalTaxAmount>10.0000</TotalTaxAmount>
               <InvoiceUniqueId>x123-456-123</InvoiceUniqueId>
            </Invoice>
            <Invoice>
               <CustomerId>CBS</CustomerId>
               <SubCustomerId></SubCustomerId>
               <InvoiceNumber>Inv1-6666</InvoiceNumber>
               <InvoiceInternalId>********-4c91-493b-b5c5-********</InvoiceInternalId>
               <InvoiceDate>2017-01-01</InvoiceDate>
               <Currency>USD</Currency>
               <InvoiceAmount>1000.0000</InvoiceAmount>
               <InvoiceDueDate>2016-04-02</InvoiceDueDate>
               <AmountDue>52.2500</AmountDue>
               <PoNum>PO001</PoNum>
               <SoNum>SO001</SoNum>
               <DivisionId>0001</DivisionId>
               <Software>QuickBooks</Software>
               <NotifyCustomer>false</NotifyCustomer>
               <InvoiceURL>https://www.ebizcharge.net/uploads/invoice001.pdf</InvoiceURL>
               <TotalTaxAmount>10.0000</TotalTaxAmount>
               <InvoiceUniqueId>x123-456-123</InvoiceUniqueId>
            </Invoice>
         </SearchInvoicesResult>
      </SearchInvoicesResponse>
   </s:Body>
</s:Envelope>
var client = new eConnect.IeBizServiceClient();
            eConnect.SecurityToken securityToken = new eConnect.SecurityToken();
            securityToken.UserId = "";
            securityToken.SecurityId = "********-90b4-4a38-ad78-********";
            securityToken.Password = "";

            var filters = new eConnect.SearchFilter[3];
            filters[0] = new eConnect.SearchFilter();
            filters[1] = new eConnect.SearchFilter();
            filters[2] = new eConnect.SearchFilter();

            filters[0].FieldName = "InvoiceDueDate";
            filters[0].ComparisonOperator = "ge";
            filters[0].FieldValue = "2015-11-25";

            filters[1].FieldName = "InvoiceDueDate";
            filters[1].ComparisonOperator = "le";
            filters[1].FieldValue = "2017-11-26";

            filters[2].FieldName = "InvoiceAmount";
            filters[2].ComparisonOperator = "ge";
            filters[2].FieldValue = "1000.00";


            eConnect.Invoice[] inv = client.SearchInvoices(securityToken, "", "", "", "", filters, 1, 3, "", false);

            for (int i = 0; i < inv.Count(); i++)
            {
                Console.WriteLine(i.ToString() + "  CustomerId: " + inv[i].CustomerId.ToString() );
                Console.WriteLine(i.ToString() + "  SubCustomerId: " + inv[i].SubCustomerId.ToString());
                Console.WriteLine(i.ToString() + "  InvoiceNumber: " + inv[i].InvoiceNumber.ToString());
                Console.WriteLine(i.ToString() + "  InvoiceInternalId: " + inv[i].InvoiceInternalId.ToString());
                Console.WriteLine(i.ToString() + "  InvoiceDate: " + inv[i].InvoiceDate.ToString());
                Console.WriteLine(i.ToString() + "  InvoiceAmount: " + inv[i].InvoiceAmount.ToString());
                Console.WriteLine(i.ToString() + "  InvoiceDueDate: " + inv[i].InvoiceDueDate.ToString());
                Console.WriteLine(i.ToString() + "  AmountDue: " + inv[i].AmountDue.ToString());
                Console.WriteLine(i.ToString() + "  TotalTaxAmount: " + inv[i].TotalTaxAmount.ToString());
                Console.WriteLine(i.ToString() + "  Software: " + inv[i].Software.ToString());
                Console.WriteLine(i.ToString() + "  InvoiceUniqueId: " + inv[i].InvoiceUniqueId.ToString());

            }