developer:soap-1.1:methods:closebatch

closeBatch

Close a batch specified by BatchNum.

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 BatchNum )

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and validate transaction.
integer BatchNum 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 batchnum:
  $batchnum='1234567';
 
  // To close the current batch use '0':
  $batchnum='0';
 
  $res=$tran->closeBatch($sourcekey,$batchnum); 
 
} 
 
catch(SoapFault $e) { 
 
  echo $e->getMessage(); 
  echo "\n\nRequest: " . $tran->__getLastRequest(); 
  echo "\n\nResponse: " . $tran->__getLastResponse(); 
 
} 
 
?> 

.NET VB

Try
            client.closeBatch(token, "0")
            MsgBox("Your batch has closed.")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

.NET C#

string BatchRefNum;
            BatchRefNum = "0";
 
            Boolean result;
 
            try
            {
                result = client.closeBatch(token, BatchRefNum);
                if (result)
                {
                    MessageBox.Show(string.Concat("The batch was closed succesfully"));
                }
                else MessageBox.Show(string.Concat("the batch was not closed"));
            }
 
 
            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> 
<BatchNum xsi:type="xsd:integer">0</BatchNum> 
</ns1:closeBatch> 
</SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 
developer/soap-1.1/methods/closebatch.txt · Last modified: 2010/10/21 15:09 by irina

Page Tools