SearchCustomers
This method allows searching for customers in EBizCharge.
Description
This method is used to search the customer database using customerInternalId or customerId.
Syntax
Customer [] [SearchCustomers(SecurityToken securityToken, string customerInternalId, string customerId, int start, int limit, string sort)
Arguments
Type | Name | Description |
---|---|---|
SecurityToken | securityToken | Merchant security token: used to identify merchant and validate transaction. (required) |
String | customerInternalId | Unique customer ID assigned by the system. (required) |
String | customerId | Customer ID. (required) |
Int | start | Start position, defaults to 0 (first customer found). (required) |
Int | limit | Maximum number of customers to return in result. (required) |
String | sort | Field name to sort the results by. (optional) |
Return Value
Type | Description |
---|---|
Customer [] | Returns array of customer objects for the matched customers. |
Examples
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";
}
<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:sort>
</ebiz:SearchCustomers>
</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">
<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>&nbsp;</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>
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();
}
Updated over 2 years ago