CancelSession
- Method
SlimCD.Sessions.CancelSession
Purpose
Prevents the session from being used.
Description
CancelSession is used to cancel a session. Cancelling a session will prevent the clerk from performing payment processing. Cancelling a session may not be possible if the payment has already been completed (in which case a VOID transaction must be performed on the gateway), or if the payment is currently in-process for payment processing with the credit card companies.
Business Rules
Argument List
Name Required Usage CancelSessionRequest 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
CancelSession Request Fields
Field Name Type Length Required Description UserName string 20 require Username or API Access Credential that accesses web service. Password string 20 require Plaintext password for the client account. SessionID string 40 require HEX string uniquely representing the session 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
- CancelSession Input Values identify the session and authenticate access to the session information.
Examples
Sample HTTP GET:
Sample HTTP POST:
URL: https://stats.slimcd.com/soft/cancelsession.asp POSTDATA:clientid=1032&password=289075&sessionid=22ADCBF1F23F19D125DF76B00B6DC75B201CB6CFSample HTML Form with POST:
- reply
- Include
123<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script>
Method
12345function CancelSession(request,callback)function CancelSession(request,timeout,callback)Request
1234567request= {"username": "1032","password": "289075","sessionid": "BCB7F196D64288552D1AEA27D52C3FF429CEB679"}Reply
1234567891011callback ( {"reply":{"response": "Success","responsecode": "0","description": "OK","responseurl": "/soft/CancelSession.asp","datablock": null}} );Sample Code
123456789101112131415161718<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script><script>// <![CDATA[SlimCD.Sessions.CancelSession({"username": "1032","password": "289075","sessionid": "BCB7F196D64288552D1AEA27D52C3FF429CEB679"},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 Sessions_CancelSession(Sessions_CancelSessionRequest $request,$timeout=false)Request
123456789class Sessions_CancelSessionRequest{// property declarationpublic $username = '';public $password = '';public $SessionID=0;}JSON Reply
123456789{"response": "Success","responsecode": "0","description": "OK","responseurl": "/soft/CancelSession.asp","datablock": null}Sample Code
12345678910111213141516171819include 'slimcd.php';// Create the Slim CD object$SlimCD = new SlimCD() ;// Create a CancelSession Request class$request = new Sessions_CancelSessionRequest() ;$request->username = '1032';$request->password = '289075';$request->sessionid = "BCB7F196D64288552D1AEA27D52C3FF429CEB679";$result = $SlimCD->Sessions_CancelSession($request);if ($result->response == 'Success') {echo 'Success!' ;}else {echo $result->response . ':' . $result->description ;}Downloads Download full sample source.
- Include
123using SlimCD;
Method
123public CancelSessionReply CancelSession(CancelSessionRequest request, int timeout);Request
123456789public class CancelSessionRequest{public string username { get; set; }public string password { get; set; }public string clientid { get; set; }public string sessionid { get; set; }}Reply
123456789101112public class CancelSessionReply{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
1234567891011121314151617181920SlimCD.Sessions sessions = new SlimCD.Sessions();sessions.debug = true;sessions.transURL = TransURL;sessions.statsURL = StatsURL;CancelSessionRequest request = new CancelSessionRequest();CancelSessionReply reply = new CancelSessionReply();request.username = 1032;request.password = 289075;request.sessionid = "BCB7F196D64288552D1AEA27D52C3FF429CEB679";reply = sessions.CancelSession(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}Downloads Download full sample source.
- Include
123using SlimCD;
Method
123public async Task CancelSession(CancelSessionRequest request, int timeout);Request
123456789public class CancelSessionRequest{public string username { get; set; }public string password { get; set; }public string clientid { get; set; }public string sessionid { get; set; }}Reply
123456789101112public class CancelSessionReply{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
1234567891011121314151617181920SlimCD.Sessions sessions = new SlimCD.Sessions();sessions.debug = true;sessions.transURL = TransURL;sessions.statsURL = StatsURL;CancelSessionRequest request = new CancelSessionRequest();CancelSessionReply reply = new CancelSessionReply();request.username = 1032;request.password = 289075;request.sessionid = "BCB7F196D64288552D1AEA27D52C3FF429CEB679";reply = await sessions.CancelSession(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}Downloads Download full sample source.
- Include
123#import "SlimCD.h"
Method
1234567typedef void (^SessionsCancelSessionReplyBlock)(SessionsCancelSessionReply *reply);- (void) sessionsCancelSessionWithRequest:(SessionsCancelSessionRequest*)request replyBlock:(SessionsCancelSessionReplyBlock)replyBlock;- (void) sessionsCancelSessionWithRequest:(SessionsCancelSessionRequest*)request timeout:(NSTimeInterval)timeout replyBlock:(SessionsCancelSessionReplyBlock)replyBlock;Request
12345678910@interface SessionsCancelSessionRequest@property (strong) NSString *userName;@property (strong) NSString *password;@property (strong) NSNumber *clientID;@property (strong) NSString *sessionID;@endReply
12345@interface SessionsCancelSessionReply : SlimCDReply@endSample Code
12345678910111213141516171819202122ÂSlimCD *api = [[SlimCD alloc] init];SessionsCancelSessionRequest *request = [[SessionsCancelSessionRequest alloc] init];request.userName = @"1032";request.password = @"289075";request.clientID = @1032;request.sessionID = @"12345";[api sessionsCancelSessionWithRequest:request replyBlock:^(SessionsCancelSessionReply *reply ){if ( reply.responseCode == RC_SUCCESS ){NSLog(@"Session cancelled successfully.");}else{NSLog(@"Unable to cancel session.");}}]; - Method
123456public void getCancelSession(CancelSessionRequest sessionCancelRequest, int timeout, CancelSessionCallback callback)public void getCancelSession(CancelSessionRequest sessionCancelRequest,CancelSessionCallback callback)
Request
123456789101112131415161718192021222324252627282930313233343536373839404142public class CancelSessionRequest extends GetBeanReference {// request parameters.private String username;private String password;private String sessionid;public CancelSessionRequest(){username="";password="";sessionid="";}// 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 String getSessionid() {return sessionid;}public void setSessionid(String sessionid) {this.sessionid = sessionid;}}Reply
123456789101112131415public class CancelSessionReply {private String datablock="";// setters and getters.public String getDatablock() {return datablock;}public void setDatablock(String datablock) {this.datablock = datablock;}}Sample Code
12345678910111213141516171819202122// Set the request parameter.CancelSessionRequest request=new CancelSessionRequest();request.setUsername("1032");request.setPassword("289075");request.setSessionid("B0625D4FF1783B493AF0D67F8F8777F55A50B49D");new SessionCancelSession().getCancelSession(request,new CancelSessionCallback() {@Overridepublic void getCancelSessionReply(CancelSessionReply reply) {if {(reply.getResponse().equals("Success"))textBox.setText("Success");}elsetextBox.setText("There was a problem:\n" + reply.getResponse() +"\n Descriptin "+ reply.getDescription());}});Downloads Download full sample source.
- 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.
12345678<!--?xml version="1.0" encoding="utf-8" ?-->Success0OK/soft/cancelsession.aspIf 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
SIMPLE HTML FORM TO SHOW CANCELSESSION
Remarks
- Remarks Go here
- URL
123https://stats.slimcd.com/soft/json/jsonscript.asp?service=CancelSession
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": "/soft/CancelSession.asp","datablock": null}}Sample Code
Remarks
- None