SearchCustomers

Description

The SearchCustomers method retrieves Customer objects from the EBizCharge platform. Results can be filtered by customerInternalId or customerId. If neither ID is included, the method returns all Customer objects.

Syntax

Customer[] SearchCustomers(SecurityToken securityToken, string customerInternalId, string customerId, int start, int limit, string sort)

Arguments

Type

Name

Req.

Description

SecurityToken

securityToken

R

A unique token that is used to identify a merchant and authenticate the API request.

string

customerInternalId

O

Internal ID for the Customer object to search for.

string

customerId

O

Custom ID for the Customer object to search for.

int

start

R

Index of the first object to return in the array.

Note: Must be ≥ 0.

int

limit

R

Maximum number of objects to return.

Note: Must be > 0.

string

sort

O

Sorts by field name.

Note: Not currently utilized.

Return Value

TypeDescription
Customer[]Returns an array of Customer objects matching the searched parameters. If no matches are found, an empty array is returned. If the operation fails, a fault is returned.

Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
   <soapenv:Header/>
   <soapenv:Body>
      <ebiz:SearchCustomers>
         <ebiz:securityToken>
            <ebiz:SecurityId>********-90b4-4a38-ad78-********</ebiz:SecurityId>
            <ebiz:UserId/>
            <ebiz:Password/>
         </ebiz:securityToken>
         <ebiz:customerInternalId></ebiz:customerInternalId>
         <ebiz:customerId></ebiz:customerId>
         <ebiz:start>1</ebiz:start>
         <ebiz:limit>3</ebiz:limit>
         <ebiz:sort/>
      </ebiz:SearchCustomers>
   </soapenv:Body>
</soapenv:Envelope>
public void SearchCustomers()
{
  eBizService apiClient = new eBizService();
  SecurityToken securityToken = new SecurityToken
  {
    SecurityId = "********-c870-41b8-aa5c-********",
    UserId = "",
    Password = ""
    };
  var response = apiClient.SearchCustomers(securityToken, "********-c6a7-41b3-a2e7-********","",0,100,"");
  Console.WriteLine(response.Count());
  Console.ReadLine();
}
function searchCustomer()
{
  $client = new SoapClient('End point URL');
  $securityToken = array(
    'SecurityId' => '******-454757-4567457-********',
    'UserId' => 'merchant1',
    'Password' => 'merchant1'
  );
  $searchCustomer = $client->SearchCustomers(array(
    'securityToken' => $securityToken,
    'customerId' => 1,
    'start' => 0,
    'limit' => 1
  ))
    ;
  if (isset($searchCustomer->SearchCustomersResult->Customer))
    echo "Success";
  else
    echo "Fail";
}

Example 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">
      <SearchCustomersResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <SearchCustomersResult>
            <Customer>
               <CustomerInternalId>********-8c22-4980-b258-********</CustomerInternalId>
               <CustomerId>0001</CustomerId>
               <FirstName>GENERAL HOSPITAL</FirstName>
               <LastName>GENERAL HOSPITAL</LastName>
               <CompanyName>GéNERAL' HOSPITAL Inc.</CompanyName>
               <Phone>18885007798</Phone>
               <Email>[email protected]</Email>
               <BillingAddress>
                  <FirstName>GENERAL HOSPITAL</FirstName>
                  <LastName>GENERAL HOSPITAL</LastName>
                  <CompanyName>GéNERAL' HOSPITAL Inc.</CompanyName>
                  <Address1>123 Alton</Address1>
                  <Address2>#25</Address2>
                  <City>Abyss</City>
                  <State>CA</State>
                  <ZipCode>56789</ZipCode>
               </BillingAddress>
            </Customer>
            <Customer>
               <CustomerInternalId>********-6921-4001-8854-********</CustomerInternalId>
               <CustomerId>0002</CustomerId>
               <FirstName>ROYAL  HOSP CH</FirstName>
               <LastName>ROYAL  HOSP CH</LastName>
               <CompanyName>ROYAL  HOSP CH</CompanyName>
               <Phone/>
               <Email/>
               <BillingAddress>
                  <FirstName>ROYAL  HOSP CH</FirstName>
                  <LastName>ROYAL  HOSP CH</LastName>
                  <CompanyName>ROYAL  HOSP CH</CompanyName>
                  <Address1>nbsp</Address1>
                  <Address2>nbsp</Address2>
                  <City>nbsp;</City>
                  <State>AB</State>
                  <ZipCode>nbsp;</ZipCode>
               </BillingAddress>
            </Customer>
            <Customer>
               <CustomerInternalId>********-2107-44c9-968b-********</CustomerInternalId>
               <CustomerId>0003</CustomerId>
               <FirstName>GENERAL HOSPITAL NY</FirstName>
               <LastName>GENERAL HOSPITAL NY</LastName>
               <CompanyName>GENERAL HOSPITAL NY</CompanyName>
               <Phone/>
               <Email/>
               <BillingAddress>
                  <FirstName>GENERAL HOSPITAL NY</FirstName>
                  <LastName>GENERAL HOSPITAL NY</LastName>
                  <CompanyName>GENERAL HOSPITAL NY</CompanyName>
                  <Address1/>
                  <Address2/>
                  <City/>
                  <State>ON</State>
                  <ZipCode/>
               </BillingAddress>
            </Customer>
         </SearchCustomersResult>
      </SearchCustomersResponse>
   </s:Body>
</s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode>s:Client</faultcode>
         <faultstring xml:lang="en-US">Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).</faultstring>
      </s:Fault>
   </s:Body>
</s:Envelope>