SearchBatches
Description
The SearchBatches method retrieves batches from the EBizCharge Gateway.
Syntax
BatchSearchResult SearchBatches(SecurityToken securityToken, SearchFilter[] filters, boolean matchAll, boolean countOnly, string start, string limit, string sort)
Arguments
Type | Name | Description | |
|---|---|---|---|
securityToken | R | A unique token that is used to identify a merchant and authenticate the API request. | |
SearchFilter [] | filters | R | Filters BatchStatus objects based on one or more field names, comparison operators, and field values. See supported search parameters below. |
boolean | matchAll | R | Whether results must match all search criteria. Note: If |
boolean | countOnly | R | Whether the response should include only the total count of matching objects, excluding the objects themselves. |
string | start | O | Index of the first object to return in the array. Note: Must be ≥ 0. The default value is |
string | limit | O | Maximum number of objects to return. Note: Must be > 0. The default value is |
string | sort | O | Sorts by field name. Supported Sort Parameters
|
Return Value
| Type | Description |
|---|---|
| BatchSearchResult | On success, returns a list of BatchStatus objects along with the result counts, limit, and starting index. Otherwise, an empty response is returned. |
Supported Search Parameters
| Parameter | Description | Example of Use |
|---|---|---|
| BatchRefNum | Filters by the batch reference number. | |
| Closed | Filters by the date the batch closed. | |
| Opened | Filters by the date the batch was created. | |
| Sequence | Filters by the batch's sequence number. | |
| Status | Filters by the status of the batch | |
Example Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
<soapenv:Header/>
<soapenv:Body>
<ebiz:SearchBatches>
<ebiz:securityToken>
<ebiz:SecurityId>*************-b899-9301b****************</ebiz:SecurityId>
<ebiz:UserId/>
<ebiz:Password/>
</ebiz:securityToken>
<ebiz:filters>
<ebiz:SearchFilter>
<ebiz:FieldName>Sequence</ebiz:FieldName>
<ebiz:ComparisonOperator>gt</ebiz:ComparisonOperator>
<ebiz:FieldValue>0</ebiz:FieldValue>
</ebiz:SearchFilter>
</ebiz:filters>
<ebiz:matchAll>false</ebiz:matchAll>
<ebiz:countOnly>false</ebiz:countOnly>
<ebiz:start>0</ebiz:start>
<ebiz:limit>100</ebiz:limit>
<ebiz:sort>Closed</ebiz:sort>
</ebiz:SearchBatches>
</soapenv:Body>
</soapenv:Envelope>private static void SearchBatches()
{
IeBizService apiClient = new IeBizServiceClient();
SecurityToken securityToken = new SecurityToken()
{
SecurityId = "*************-4970-ba92-************",
UserId = "*************-4970-ba92-************",
Password = "*************-4970-ba92-************"
};
SearchFilter[] filters = new SearchFilter[2];
//Example 1: Find all closed Batches with Status equal to a value
filters[0] = new SearchFilter();
filters[0].FieldName = "closed";
filters[0].ComparisonOperator = "eq"; // equals
filters[0].FieldValue = "2017-12-01";
//Example 2: Find all opened Batches with CreatedDate greater than a specific date
filters[1] = new SearchFilter();
filters[1].FieldName = "opened";
filters[1].ComparisonOperator = "gt"; // greater than
filters[1].FieldValue = "2023-01-01";
bool matchAll = false;
bool countOnly = false;
string start = "0";
string limit = "10";
string sort = "closed";
//Call SearchBatches API
BatchSearchResult batchResult = apiClient.SearchBatches(
securityToken,
filters,
matchAll,
countOnly,
start,
limit,
sort
);
//Display results
Console.WriteLine($"BatchesMatched: {batchResult.BatchesMatched}");
Console.WriteLine($"BatchesReturned:{batchResult.BatchesReturned}");
Console.WriteLine($"StartIndex: {batchResult.StartIndex}");
Console.WriteLine($"Limit: {batchResult.Limit}");
if (batchResult.Batches != null)
{
for (int i = 0; i < batchResult.Batches.Length; i++)
{
var batch = batchResult.Batches[i];
Console.WriteLine($"--- Batch #{i + 1} ---");
Console.WriteLine($"BatchRefNum: {batch.BatchRefNum}");
Console.WriteLine($"Sequence: {batch.Sequence}");
Console.WriteLine($"Status: {batch.Status}");
Console.WriteLine($"Opened: {batch.Opened}");
Console.WriteLine($"Closed: {batch.Closed}");
Console.WriteLine($"Scheduled: {batch.Scheduled}");
Console.WriteLine($"TransactionCount: {batch.TransactionCount}");
Console.WriteLine($"SalesCount: {batch.SalesCount}");
Console.WriteLine($"SalesAmount: {batch.SalesAmount:C}");
Console.WriteLine($"CreditsCount: {batch.CreditsCount}");
Console.WriteLine($"CreditsAmount: {batch.CreditsAmount:C}");
Console.WriteLine($"VoidsCount: {batch.VoidsCount}");
Console.WriteLine($"VoidsAmount: {batch.VoidsAmount:C}");
Console.WriteLine($"NetAmount: {batch.NetAmount:C}");
Console.WriteLine();
}
}
Console.WriteLine();
}// Initialize the SOAP client (replace with your actual endpoint URL)
$client = new SoapClient("https://ebizsoapapidev1.ebizcharge.net/eBizService.svc?singleWsdl");
// Define the merchant security token
$securityToken = array(
'SecurityId' => '*************-4970-ba92-************' // Replace with your actual token
);
$filters = array(
array(
'FieldName' => 'closed',
'ComparisonOperator' => 'eq',
'FieldValue' => '2017-12-01'
),
array(
'FieldName' => 'opened',
'ComparisonOperator' => 'gt',
'FieldValue' => '2023-01-01'
),
);
// Other parameters
$matchAll = false;
$countOnly = false;
$start = "0";
$limit = "10";
$sort = "closed";
// SOAP parameters
$params = array(
'securityToken' => $securityToken,
'filters' => $filters,
'matchAll' => $matchAll,
'countOnly' => $countOnly,
'start' => $start,
'limit' => $limit,
'sort' => $sort,
);
try {
$response = $client->SearchBatches($params);
if (!isset($response->SearchBatchesResult)) {
echo "No SearchBatchesResult found in response.\n";
exit;
}
$result = $response->SearchBatchesResult;
echo "BatchesMatched: " . ($result->BatchesMatched ?? 0) . "\n";
echo "BatchesReturned: " . ($result->BatchesReturned ?? 0) . "\n";
echo "StartIndex: " . ($result->StartIndex ?? 0) . "\n";
echo "Limit: " . ($result->Limit ?? 0) . "\n\n";
// So we first get the Batches container, then its children.
if (!isset($result->Batches)) {
echo "No Batches element found.\n";
// var_dump($result);
exit;
}
$batchesContainer = $result->Batches;
if (isset($batchesContainer->BatchStatus)) {
$batches = $batchesContainer->BatchStatus;
}
// Normalize to array
if (!is_array($batches)) {
$batches = $batches ? array($batches) : array();
}
if (count($batches) === 0) {
echo "No BatchStatus records found.\n";
exit;
}
foreach ($batches as $i => $batch) {
echo "--- Batch #" . ($i + 1) . " ---\n";
echo "BatchRefNum: " . ($batch->BatchRefNum ?? '') . "\n";
echo "Sequence: " . ($batch->Sequence ?? '') . "\n";
echo "Status: " . ($batch->Status ?? '') . "\n";
echo "Opened: " . ($batch->Opened ?? '') . "\n";
echo "Closed: " . ($batch->Closed ?? '') . "\n";
echo "Scheduled: " . ($batch->Scheduled ?? '') . "\n";
echo "TransactionCount: " . ($batch->TransactionCount ?? '') . "\n";
echo "SalesCount: " . ($batch->SalesCount ?? '') . "\n";
echo "CreditsCount: " . ($batch->CreditsCount ?? '') . "\n";
echo "VoidsCount: " . ($batch->VoidsCount ?? '') . "\n";
echo "SalesAmount: " . ($batch->SalesAmount ?? '') . "\n";
echo "CreditsAmount: " . ($batch->CreditsAmount ?? '') . "\n";
echo "NetAmount: " . ($batch->NetAmount ?? '') . "\n";
echo "VoidsAmount: " . ($batch->VoidsAmount ?? '') . "\n";
echo "\n";
}
} catch (SoapFault $e) {
// Handle any SOAP errors
echo "SOAP Error: " . $e->getMessage();
}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">
<SearchBatchesResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
<SearchBatchesResult>
<Batches>
<BatchStatus>
<SalesAmount>3.13</SalesAmount>
<BatchRefNum>***087</BatchRefNum>
<Closed/>
<CreditsAmount>0</CreditsAmount>
<CreditsCount>0</CreditsCount>
<NetAmount>3.13</NetAmount>
<Opened>12/15/2025T09:18:29</Opened>
<VoidsCount>0</VoidsCount>
<SalesCount>1</SalesCount>
<Scheduled/>
<Sequence>2</Sequence>
<Status>Open</Status>
<TransactionCount>1</TransactionCount>
<VoidsAmount>0</VoidsAmount>
</BatchStatus>
<BatchStatus>
<SalesAmount>60922.27</SalesAmount>
<BatchRefNum>***276</BatchRefNum>
<Closed>12/15/2025T09:00:50</Closed>
<CreditsAmount>0</CreditsAmount>
<CreditsCount>0</CreditsCount>
<NetAmount>60922.27</NetAmount>
<Opened>10/02/2025T16:23:12</Opened>
<VoidsCount>3</VoidsCount>
<SalesCount>217</SalesCount>
<Scheduled/>
<Sequence>1509</Sequence>
<Status>Closed</Status>
<TransactionCount>220</TransactionCount>
<VoidsAmount>106.51</VoidsAmount>
</BatchStatus>
</Batches>
<BatchesMatched>2</BatchesMatched>
<BatchesReturned>2</BatchesReturned>
<Limit>100</Limit>
<StartIndex>0</StartIndex>
</SearchBatchesResult>
</SearchBatchesResponse>
</s:Body>
</s:Envelope><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">
<SearchBatchesResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
<SearchBatchesResult/>
</SearchBatchesResponse>
</s:Body>
</s:Envelope>Updated 5 months ago
