CloseBatch
- Method
SlimCD.Transact.CloseBatch
Purpose
Closes the current batch of transactions on SLIM CD’s servers by releasing them to the processor.
Description
Transactions processed through SLIM CD are stored in batches. These transactions will not be funded to the merchant until the batch is closed. After closing a batch you can no longer perform VOID, TIPEDIT, or UPDATE transactions against a previous transaction included in the batch.
Business Rules
Argument List
Name Required Usage CloseBatchRequest Required Object containing properties for the request timeout Optional Integer wait time, in seconds, before timeout response is generated callback* Optional Function to call upon completion of asynchronous request *for JavaScript only
CloseBatchRequest Fields
Field Name Type Length Required Description Username string 20 require Username or API Access Credential that accesses web service. Password string 20 required Plaintext password for the client account. SiteID integer 10 optional Assigned by the Slim CD administrator. BatchNumber string 12 not required The processor’s batch number. Do not use unless instructed by SLIM CD. 1. Passwords are required except when the username is set to an API Access Credential, in which case it should be passed in as an empty string.
Reply Fields
reply outer tag for the reply data block response Success, FAIL, Error response code 0, 1, 2 (respective) matching the above description If successful, this will contain the single word, OK. Otherwise it will contain a description of failure or error which occurred reponseurl The Slimcd.com url which was called for this operation datablock The confirmation text returned from the server. Reply Hierarchy
- reply
- response
- responsecode
- description
- responseurl
- datablock
Remarks
- General
- Names in name/value pairs are NOT case-sensitive
- Names inside XML tags ARE case-sensitive
- Function-Specific
- None
- reply
- Include
123<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script>
Method
12345function CloseBatch(request,callback)function CloseBatch(request,timeout,callback)Request
12345678request= {"username": "R6UT8C6M","password": "","siteid": "0","batchnumber": "0"}Reply
1234567891011callback ( {"reply":{"response":"Success","responsecode":"0","description":"OK","responseurl":"/wswebservices/transact.asmx/CloseBatch","datablock":"Y*876624\n"}} );Sample Code
12345678910111213141516171819<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script><script>// <![CDATA[SlimCD.Transact.CloseBatch({"username": "R6UT8C6M","password": "","siteid": "0","batchnumber": "0"},function (reply) {if (reply.response == "Success") {alert ('Batch Closed');} else {alert('There was a problem closing the batch:\r\n' + reply.description);}});// ]]></script>Downloads
- Include
123include 'slimcd.php';
Method
123function Transact_CloseBatch(Transact_CloseBatchRequest $request,$timeout=false)Request
1234567891011class Transact_CloseBatchRequest{// property declarationpublic $username = '';public $password = '';public $siteid=0;public $batchnumber='';}JSON Reply
1234567891011121314151617{{"reply": {"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/transact.asmx/CloseBatch","datablock": "Y*893995\n"}}}Sample Code
123456789101112131415161718192021include 'slimcd.php';// Create the Slim CD object$SlimCD = new SlimCD() ;// Create a CloseBatch Request class$request = new Transact_CloseBatchRequest() ;$request->username= 'R6UT8C6M';$request->password = '';$request->siteid = 0;$request->batchnumber = 0;$result = $SlimCD->Transact_CloseBatch($request);if ($result->response == 'Success') {echo 'Success!' ;}else {echo $result->response . ':' . $result->description ;}Downloads
- Include
123using SlimCD;
Method
123public CloseBatchReply CloseBatch(CloseBatchRequest request, int timeout);Request
123456789public class CloseBatchRequest{public string username { get; set; }public string password { get; set; }public int siteid { get; set; }public string batchnumber { get; set; }}Reply
123456789101112public class CloseBatchReply{public string response;public string responsecode;public string description;public string responseurl;public string datablock;public string senddata;public string recvdata;}Cross Reference: Client
Sample Code
123456789101112131415161718192021SlimCD.Transact transact = new SlimCD.Transact();transact.debug = true;transact.transURL = TransURL;transact.statsURL = StatsURL;CloseBatchRequest request = new CloseBatchRequest();CloseBatchReply reply = new CloseBatchReply();request.username = "R6UT8C6M";request.password = "";request.siteid = 0;request.batchnumber = 0;reply = transact.CloseBatch(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}Downloads
- Include
123using SlimCD;
Method
123public async Task CloseBatch(CloseBatchRequest request, int timeout);Request
123456789public class CloseBatch(Request{public string username { get; set; }public string password { get; set; }public int siteid { get; set; }public string batchnumber { get; set; }}Reply
123456789101112public class CloseBatch(Reply{public string response;public string responsecode;public string description;public string responseurl;public string datablock;public string senddata;public string recvdata;}Cross Reference: Client
Sample Code
123456789101112131415161718192021SlimCD.Transact transact = new SlimCD.Transact();transact.debug = true;transact.transURL = TransURL;transact.statsURL = StatsURL;CloseBatchRequest request = new CloseBatchRequest();CloseBatchReply reply = new CloseBatchReply();request.username = "R6UT8C6M";request.password = "";request.siteid = 0;request.batchnumber = 0;reply = await transact.CloseBatch(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}Downloads
- Include
123#import "SlimCD.h"
Method
1234567typedef void (^TransactCloseBatchReplyBlock)(TransactCloseBatchReply *reply);- (void) transactCloseBatchWithRequest:(TransactCloseBatchRequest*)request replyBlock:(TransactCloseBatchReplyBlock)replyBlock;- (void) transactCloseBatchWithRequest:(TransactCloseBatchRequest*)request timeout:(NSTimeInterval)timeout replyBlock:(TransactCloseBatchReplyBlock)replyBlock;Request
12345678910@interface TransactCloseBatchRequest@property (strong) NSString *userName;@property (strong) NSString *password;@property (strong) NSNumber *siteID;@property (strong) NSString *batchNumber;@endReply
1234567@interface TransactCloseBatchReply : SlimCDReply@property (strong) NSString *message;@endSample Code
123456789101112131415161718192021ÂSlimCD *api = [[SlimCD alloc] init];TransactCloseBatchRequest *request = [[TransactCloseBatchRequest alloc] init];request.userName = @"1032";request.password = @"289075";request.siteID = @228226448;request.batchNumber = @"0";[api transactCloseBatchWithRequest:request replyBlock:^(TransactCloseBatchReply *reply){if ( reply.responseCode == RC_SUCCESS ){NSLog(@"Batch closed successfully");}else{NSLog(@"Unable to close batch.");}}]; - Method
12345public void closeBatch(CloseBatchRequest transactCloseBatchRequest,int timeout, CloseBatchCallback callback)public void closeBatch(CloseBatchRequest transactCloseBatchRequest,CloseBatchCallback callback)
Request
1234567891011121314151617181920212223242526272829303132333435363738394041424344public class CloseBatchRequest {private String username;private String password;private int siteid;private String batchnumber;// set te default value.public CloseBatchRequest() {username="";password="";siteid=0;batchnumber="";}// setters and getters.public String getUsername() {return username;}public void setUsername(String username) {this.username = username;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}public int getSiteid() {return siteid;}public void setSiteid(int siteid) {this.siteid = siteid;}public String getBatchnumber() {return batchnumber;}public void setBatchnumber(String batchnumber) {this.batchnumber = batchnumber;}}Reply
12345678910111213141516public class CloseBatchReply{private String datablock;public CloseBatchReply(){datablock="";}public String getDatablock() {return datablock;}public void setDatablock(String datablock) {this.datablock = datablock;}}Sample Code
12345678910111213141516171819202122232425262728// set the request parameters.CloseBatchRequest request=new CloseBatchRequest();request.setBatchnumber("0");request.setPassword("");request.setSiteid(0);request.setUsername("R6UT8C6M");//To make web service request.new TransactCloseBatch().closeBatch(request, new CloseBatchCallback(){ @Overridepublic void getTransactCloseBatchReply(CloseBatchReply reply){if (reply.getResponse().equals("Success"))textBox.setText("Success");}elsetextBox.setText("There was a problem:\n" + reply.getResponse()+"\n Descriptin "+ reply.getDescription());});Downloads
- URL
Protocols
- SOAP/XML
- HTTP POST
- HTTP GET
Request
Status Codes
Status Code Status Description Explanation 200 200 OK Approved or declined attempts will return a response with an XML reply block 500 500 Internal Server Error The response will not contain XML, as a server error has occurred. Reply
Output is in XML format if a status code of 200 is returned.
123456789<!--?xml version="1.0" encoding="utf-8" ?-->Success0OKhttps://stats.slimcd.com/wswebservices/transact.asmx/CloseBatchY*875873If the block’s tag does not indicate “Success”, the tag will contain an error description which can be displayed to the end-user
Sample Code
DOWNLOAD
EXERCISER TOOL
Remarks
- For .NET programmers, this is a discoverable web serivce using Visual Studio
- This routine can take a long time. Please set your HTTP connection’s timeout appropriately (600 seconds)
- SiteID is defined as an “int” and must contain a numeric (non-blank) value
- BatchNumber is defined as a “string” and can/should be blank
- Only SLIM CD’s support will use a value for the batch number, so you should hardcode this to blank
- URL
123https://stats.slimcd.com/soft/json/jsonscript.asp?service=CloseBatch
Protocols
- HTTP POST
- HTTP GET
This function accepts either name/value pairs or JSON
Request
Reply
1234567891011{"reply": {"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/transact.asmx/CloseBatch","datablock": "Y*893995\n"}}Sample Code
Remarks
- The jsonpayment.asp entry point returns a standard datablock on approved, declined, and errors for credit card transactions, making it easier to parse for class libraries.
- The jsonscript.asp entry point can also be called with service=ProcessTransaction (or PostXML or PostHTTP), but the datablock may not contain all elements on decline or error responses
- Check and gift card transactions may return different elements in the datablock than credit card transactions