searchCustomers

Parent Previous Next

searchCustomers

Search for customers.

 

Description

 

This method allows you to search the customer database using flexible search terms. This method searches the customer database (aka recurring billing) not the transactions history. To search the transaction history for a specific customer, use either the searchTransactions or getCustomerHistory method.

Use as many or as few search terms as you like. With MatchAll set to “true,” all terms must match to return a result. If the search does not yield the desired results, try broadening your search by eliminating terms, or change MatchAll to “false.”

Valid field names for search and sort are:

 

Syntax

 

CustomerSearchResult searchCustomers ( 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.

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

Start position, defaults to 0 (first customer found).

integer

Limit

Maximum number of customers to return in result.

string

Sort

Field name to sort the results by

 

Return Value

 

CustomerSearchResult

Returns results of customer search based on parameters set.

 

Examples

 

PHP

 

<?php

try {

 $search=array(

   array(

     'Field'=>'amount',  

     'Type'=>'gt',

     'Value'=>'8.00'),

   array(

     'Field'=>'failures',  

     'Type'=>'gt',  

     'Value'=>'0')

   );

 $start=0;

 $limit=10;

 $matchall=true;

 $RefNum=1009411;

 $Sort = "fname";

 $res=$client->searchCustomers($token,$search,$matchall,$start,$limit,$Sort);

 print_r($res);

 $this->assertTrue($res->CustomersMatched>0 && $res->CustomersReturned>0);

}

catch (SoapFault $e) {

 die("Search Customers failed :" .$e->getMessage());

}

?>

 

 

.NET VB

 

Dim matchAll As Boolean

       matchAll = True

       Dim search(0) As eBizCharge.SearchParam

       search(0) = New eBizCharge.SearchParam()

       search(0).Field = "Created"

       search(0).Type = "Contains"

       search(0).Value = "2010-09-09"

       Dim response As eBizCharge.CustomerSearchResult = New eBizCharge.CustomerSearchResult

       response = client.searchCustomers(token, search, matchAll, "0", "10", "fname")

       MsgBox(response.CustomersMatched)

 

 

.NET C#

 

 

Boolean matchAll;

           matchAll = true;

           eBizCharge.SearchParam[] search = new eBizCharge.SearchParam[2];

           search[0] = new eBizCharge.SearchParam();

           search[0].Field = "Created";

           search[0].Type = "Contains";

           search[0].Value = "2010-08-10";

           eBizCharge.CustomerSearchResult response = new eBizCharge.CustomerSearchResult();

           try

           {

               response = client.searchCustomers(token, search, matchAll, "0", "10", "fname");

               MessageBox.Show(response.CustomersMatched);

           }

           catch (Exception err)

           {

               MessageBox.Show(err.Message);

           }

: