developer:soap:methods:closebatch

This is an old revision of the document!


Soap API v1.2

closeBatch

Close a batch specified by BatchRefNum.

Description

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.

See also getBatchStatus, searchBatches, getBatchTransactions

Syntax

boolean closeBatch ( ueSecurityToken Token, integer BatchRefNum )

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and validate transaction.
integer BatchRefNum A unique batch reference number assigned by the gateway.

Return Value

boolean Returns confirmation of the close batch request only if successful. If request fails, an exception will be thrown.

Examples

PHP

For directions on how to set up the WSDL link, create “$token” and “$client”, go to PHP Soap How-to.

 <?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(); 
 
} 
 
?> 

C Sharp (.Net)

For directions on how to set up the WSDL link, create “token” and “client”, go to C Sharp Soap How-to.

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

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ns1="urn:usaepay" 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">77e60a21703daa1969aa2e2b51622a6e38a1f939</HashValue> 
<Seed xsi:type="xsd:string">1193783481292404114</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> 

Change History

Version Change
1.2 Renamed BatchNum Parameter to BatchRefNum
1.1 Soap 1.1 Release
developer/soap/methods/closebatch.1248718393.txt.gz · Last modified: 2009/07/27 11:13 by tem

Page Tools