Close a batch specified by BatchRefNum.
This method will close or settle an open batch. Upon settlement the funds will be transferred to the merchant's bank account.
To check the status of a batch and determine whether it has already been settled, is still open, or awaiting settlement, use the getBatchStatus method.
boolean closeBatch ( ueSecurityToken Token, integer BatchRefNum )
Type |
Name |
Description |
Token |
Merchant security token: used to identify merchant and validate transaction. |
|
integer |
BatchRefNum |
A unique batch reference number assigned by the gateway. |
boolean |
Returns confirmation of the close batch request only if successful. If request fails, an exception will be thrown. |
<?php
try {
// To close a specific batch use the gateway assigned batchrefnum:
$batchrefnum='1234567';
// To close the current batch use '0':
$batchrefnum='0';
$res=$tran->closeBatch($sourcekey,$batchrefnum);
}
catch(SoapFault $e) {
echo $e->getMessage();
echo "\n\nRequest: " . $tran->__getLastRequest();
echo "\n\nResponse: " . $tran->__getLastResponse();
}
?>
Try
client.closeBatch(token, "0")
MsgBox("Your batch has closed.")
Catch ex As Exception
MsgBox(ex.Message)
End Try
Boolean result;
// close current batch
try
{
result = client.closeBatch(token, "0");
if (result) MessageBox.Show("Batch closed successfully");
else MessageBox.Show("Batch failed to close");
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:eBizCharge" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:closeBatch>
<Token xsi:type="ns1:ueSecurityToken">
<ClientIP xsi:type="xsd:string">192.168.0.1</ClientIP>
<PinHash xsi:type="ns1:ueHash">
<HashValue xsi:type="xsd:string">11ac55b0a0b59f8f028dbf85bc32266fa973dd0e</HashValue>
<Seed xsi:type="xsd:string">12678150211876663375</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">HB4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<BatchRefNum xsi:type="xsd:integer">0</BatchRefNum>
</ns1:closeBatch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
This example uses the eBizCharge Java library. For directions on how to install the library and create the token/client objects, go to either the Java JAX-RPC Howto or the Java JAX-WS Howto.
try {
//Creating Close Batch Request object
CloseBatchRequest Request = new CloseBatchRequest();
Request.setToken(token);
//Setting batchRefNum to 0 for current batch, for a different batch set to the Batch Ref Num
Request.setBatchRefNum(BigInteger.ZERO);
CloseBatchResponse Result = client.closeBatch(Request);
} catch (Exception e) {
System.out.println("Soap Exception: " + e.getMessage());
}