CheckSession
- Method
SlimCD.Sessions.CreateSession
Purpose
Loads danto SLIM CD and returns a session id.
Description
CreateSession is used to create a SessionID. SessionID values are later used as part of a secure and tamper-resistant URL so that a browser-style application can be launched to accept cardholder information outside of the developer’s software. CreateSession can also be used to send initial customer data to SLIM CD so that payment pages are pre-populated for the clerk, providing ease of data entry.
Business Rules
CreateSession must be called before ShowSession can display a page.
Argument List
Name Required Usage CreateSessionRequest 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
Request Fields
FieldName 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 Wait int 9 require time to wait, in seconds, for CheckSession to wait while the session is being completed by the user WaitForCompleted string 3 require yes/no indicating that the CheckSession should not return intermediate results, but only final results. UserField string depends not require This is a USER-SUPPLIED field, can be named whatever the developer wants, and can be used to retrieve additional data with the form. In the case of the libraries, these field names are specified in a dictionary called “userfields”. In the case of the webservice/resource, these fields are simply included with other name/value pairs. CheckSession will return values from the form/session for any fields specified. - 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.
- ClientID, SiteID, PriceID are required if not specified in the API Access Credential
- Form name is highly recommended. FormID can also be specified, but it is unique and prevents the form from being used by more than one clientid. If not FormName is specified, the system will select a form, producing unexpected results.
- TransType is required, unless specified on the form as an editable field.
- Amount is required, unless specified on the form as an editable field.
- UserFields are any field the developer wishes to send. For direct API calls, simply add the field to the name/value pairs. For libraries, add the fields to the “userfields” dictionary associated with the CreateSessionRequest object
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
- sessionid
Remarks
- Optional Fields fall into a few categories. These include Form Data, Customer Data, Payment Data, Clerk Identification Data, and Custom Developer Data.
- Form Data allows the developer to identify the pre-configured display form to use. Form configurations are created on the SLIM CD website and referenced by name or numerical value. This identification is sent when the session is created so that the proper form configuration will be used when displaying the form data to the clerk or consumer. (Note that at this time, specifying a form is optional. The system will use the lowest FormID available for the merchant if none is specified. This approach is subject to change and SLIM CD recommends supplying form names when sessions are created to insure the display functionality meets developer expectations)
- Customer Data can include any of the payment data supported by the SLIM CD gateway. This includes First Name, Last Name, Address, City, State, Zip, etc.
- Payment Data includes other fields supported by the SLIM CD, such as TransType and Amount. If the transaction type is not specified, it will default to SALE. Specialty fields can be provided, such as Hotel Checkin Date, etc. The “gateid” field can be provided to reference customer data from previous transactions without supplying that data or cardholder information.
- Please note that CreateSession will not accept certain cardholder data information. This is to ensure that PA-DSS avoidance and PCI Scope Reduction is obtained by discouraging applications from storing or sending cardholder data. Previously processed cardholder data can be referenced using the SLIM CD “gateid” values from those previous transactions.
- The following fields will not be accepted by the CreateSession function: Card Number, Track Data, CVV2, or PIN Block data fields. If the developer desires to provide this information to SLIM CD as part of a conversion that eliminates cardholder data storage, we recommend using the SLIM CD Developer’s Toolkit and perform the “LOAD” function.
Examples
Sample HTTP GET:
Sample HTTP POST:
URL:https://stats.slimcd.com/soft/checksession.asp POSTDATA:clientid=1032&password=289075&wait=60&sessionid=22ADCBF1F23F19D125DF76B00B6DC75B201CB6CFSample HTML Form with POST:
- Include
123<script type="text/javascript" src="https://trans.slimcd.com/soft/json/slimcd.js"></script>
Method
12345function CheckSession(request,callback)function CheckSession(request,timeout,callback)Request
12345678910request= {"username": "1032","password": "289075","sessionid": "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439","wait": "5","waitforcompleted": "no","userfield": ""}Reply
123456789101112131415161718192021222324252627282930313233343536callback ( {"reply":{"response": "Success","responsecode": "0","description": "OK","responseurl": "/soft/CheckSession.asp","datablock": {"sessionid": "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439","completed": "yes","approved": "Y","declinecount": "0","gateid": "78652455","transtype": "SALE","authcode": "TAS981","avsreply": null,"cvv2reply": null,"declinestr": "OK","cardtype": "V","cardname": "Visa","first6": "444455","last4": "9999","keyed": "Yes","expmonth": "07","expyear": "13","approvedamt": "10","tip": "0","bal": "0","invoiceno": null,"corporatecardindicator": null,"processor_token": null,"test_checkbox": "1","userfield": "value"}} );Sample Code
123456789101112131415161718192021<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script><script>// <![CDATA[SlimCD.Sessions.CheckSession({"username": "1032","password": "289075","sessionid": "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439","wait": "5","waitforcompleted": "no","userfield": ""},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_CheckSession(Sessions_CheckSessionRequest $request,$timeout=false)Request
12345678910111213class Sessions_CheckSessionRequest{// property declarationpublic $username = '';public $password = '';public $SessionID=0;public $Wait=0;public $WaitForCompleted='';public $userfields=null;}JSON Reply
1234567891011121314151617181920212223242526272829303132333435{"response": "Success","responsecode": "0","description": "OK","responseurl": "/soft/CheckSession.asp","datablock": {"sessionid": "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439","completed": "yes","approved": "Y","declinecount": "0","gateid": "78652455","transtype": "SALE","authcode": "TAS981","avsreply": null,"cvv2reply": null,"declinestr": "OK","cardtype": "V","cardname": "Visa","first6": "444455","last4": "9999","keyed": "Yes","expmonth": "07","expyear": "13","approvedamt": "10","tip": "0","bal": "0","invoiceno": null,"corporatecardindicator": null,"processor_token": null,"test_checkbox": "1","userfields": null}}Sample Code
1234567891011121314151617181920212223include 'slimcd.php';// Create the Slim CD object$SlimCD = new SlimCD() ;// Create a CheckSession Request class$request = new Sessions_CheckSessionRequest() ;$request->;username = '1032';$request->;password = '289075';$request->;sessionid = "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439";$request->;wait= '5';$request->;waitforcompleted= "no";$request->->userfields= array("mycustomfield","mycustomvalue");$result = $SlimCD->Sessions_CheckSession($request);if ($result->response == 'Success') {echo 'Success!' ;}else {echo $result->response . ':' . $result->description ;}Downloads
- Include
123using SlimCD;
Method
123public CheckSessionReply CheckSession(CheckSessionRequest request, int timeout);Request
1234567891011public class CheckSessionRequest{public string username { get; set; }public string password { get; set; }public string wait { get; set; }public string waitforcompleted { get; set; }public string sessionid { get; set; }public Dictionary<string, string> userfields { get; set; }}Reply
1234567891011121314151617181920212223242526272829303132333435public class CheckSessionReply{public string response;public string responsecode;public string description;public string responseurl;public string sessionid;public string completed;public string approved;public string declinecount;public string gateid;public string transtype;public string authcode;public string avsreply;public string cvv2reply;public string declinestr;public string cardtype;public string cardname;public string first6;public string last4;public string keyed;public string expmonth;public string expyear;public string approvedamt;public string tip;public string bal;public string invoiceno;public string corporatecardindicator;public string processor_token;public Dictionary<string, string> userfields;public string senddata;public string recvdata;}Cross Reference: Client
Sample Code
12345678910111213141516171819202122SlimCD.Sessions sessions = new SlimCD.Sessions();sessions.debug = true;sessions.transURL = TransURL;sessions.statsURL = StatsURL;CheckSessionRequest request = new CheckSessionRequest();CheckSessionReply reply = new CheckSessionReply();request.username = 1032;request.password = 289075;request.sessionid = "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439";request.wait = 5;request.waitforcompleted = "no";reply = sessions.CheckSession(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<CheckSessionReply> CheckSession(CheckSessionRequest request, int timeout);Request
1234567891011public class CheckSessionRequest{public string username { get; set; }public string password { get; set; }public string wait { get; set; }public string waitforcompleted { get; set; }public string sessionid { get; set; }public Dictionary<string, string> userfields { get; set; }}Reply
1234567891011121314151617181920212223242526272829303132333435public class CheckSessionReply{public string response;public string responsecode;public string description;public string responseurl;public string sessionid;public string completed;public string approved;public string declinecount;public string gateid;public string transtype;public string authcode;public string avsreply;public string cvv2reply;public string declinestr;public string cardtype;public string cardname;public string first6;public string last4;public string keyed;public string expmonth;public string expyear;public string approvedamt;public string tip;public string bal;public string invoiceno;public string corporatecardindicator;public string processor_token;public Dictionary<string, string> userfields;public string senddata;public string recvdata;}Cross Reference: Client
Sample Code
12345678910111213141516171819202122SlimCD.Sessions sessions = new SlimCD.Sessions();sessions.debug = true;sessions.transURL = TransURL;sessions.statsURL = StatsURL;CheckSessionRequest request = new CheckSessionRequest();CheckSessionReply reply = new CheckSessionReply();request.username = 1032;request.password = 289075;request.sessionid = "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439";request.wait = 5;request.waitforcompleted = "no";reply = await sessions.CheckSession(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
123typedef void (^SessionsCheckSessionReplyBlock)(SessionsCheckSessionReply *reply); - (void) sessionsCheckSessionWithRequest:(SessionsCheckSessionRequest*)request replyBlock:(SessionsCheckSessionReplyBlock)replyBlock; - (void) sessionsCheckSessionWithRequest:(SessionsCheckSessionRequest*)request timeout:(NSTimeInterval)timeout replyBlock:(SessionsCheckSessionReplyBlock)replyBlock;Request
12345678910111213@interface SessionsCheckSessionRequest@property (strong) NSString *userName;@property (strong) NSString *password;@property (strong) NSNumber *clientID;@property (strong) NSString *wait;@property (strong) NSString *waitForCompleted;@property (strong) NSString *sessionID;@property (strong) NSMutableDictionary *userFields;@endReply
123456789101112131415161718192021222324252627282930@interface SessionsCheckSessionReply : SlimCDReply@property (strong) NSString *sessionID;@property (strong) NSString *completed;@property (strong) NSString *approved;@property (strong) NSString *declineCount;@property (strong) NSNumber *gateID;@property (strong) NSString *transType;@property (strong) NSString *authCode;@property (strong) NSString *avsReply;@property (strong) NSString *cvv2Reply;@property (strong) NSString *declineStr;@property (strong) NSString *cardType;@property (strong) NSString *cardName;@property (strong) NSString *first6;@property (strong) NSString *last4;@property (strong) NSString *keyed;@property (strong) NSString *expMonth;@property (strong) NSString *expYear;@property (strong) NSString *approvedAmt;@property (strong) NSString *tip;@property (strong) NSString *bal;@property (strong) NSString *invoiceNo;@property (strong) NSString *corporateCardIndicator;@property (strong) NSString *processor_token;@property (strong) NSMutableDictionary *userFields;@endSample Code
1234567891011121314151617181920212223242526SlimCD *api = [[SlimCD alloc] init];SessionsCheckSessionRequest *request = [[SessionsCheckSessionRequest alloc] init];request.userName = @"1032";request.password = @"289075";request.clientID = @1032;request.sessionID = @"12345";request.wait = @"5";request.waitForCompleted = @"no";(request.userFields)[@"checkField1"] = @"Value 1";(request.userFields)[@"checkField2"] = @"Value 2";[api sessionsCheckSessionWithRequest:request replyBlock:^(SessionsCheckSessionReply *reply ){if ( reply.responseCode == RC_SUCCESS ){NSLog(@"Session check successful.");}else{NSLog(@"Session check failed.");}}]; - Method
1234567public void getCheckSession(CheckSessionRequest sessionCheckRequest,int timeout ,CheckSessionCallback callback)public void getCheckSession( CheckSessionRequest sessionCheckRequest,CheckSessionCallback callback)
Request
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172public class CheckSessionRequest {// request parameters.private String username;private String password;private String sessionid;private String wait;private String waitforcompleted;private HashMap<String, String> userfield;public CheckSessionRequest(){username="";password="";sessionid="";wait="";userfield=null;waitforcompleted="";}// setter and getters.public String getWaitforcompleted() {return waitforcompleted;}public void setWaitforcompleted(String waitforcompleted) {this.waitforcompleted = waitforcompleted;}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;}public String getWait() {return wait;}public void setWait(String wait) {this.wait = wait;}public HashMap<String, String> getUserfield() {return userfield;}public void setUserfield(HashMap<String, String> userfield) {this.userfield = userfield;}}Reply
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187public class CheckSessionReply {private String sessionid="";private String completed="";private String approved="";private String declinecount="";private String gateid="";private String transtype="";private String authcode="";private String avsreply="";private String cvv2reply="";private String declinestr="";private String cardtype="";private String cardname="";private String first6="";private String last4="";private String keyed="";private String expmonth="";private String expyear="";private String approvedamt="";private String tip="";private String bal="";private String invoiceno="";private String corporatecardindicator="";private String processor_token="";private String test_checkbox="";private HashMap<String, String> userfield;public CheckSessionReply(){userfield=new HashMap<String, String>();}// setters and getters.public String getSessionid() {return sessionid;}public void setSessionid(String sessionid) {this.sessionid = sessionid;}public String getCompleted() {return completed;}public void setCompleted(String completed) {this.completed = completed;}public String getApproved() {return approved;}public void setApproved(String approved) {this.approved = approved;}public String getDeclinecount() {return declinecount;}public void setDeclinecount(String declinecount) {this.declinecount = declinecount;}public String getGateid() {return gateid;}public void setGateid(String gateid) {this.gateid = gateid;}public String getTranstype() {return transtype;}public void setTranstype(String transtype) {this.transtype = transtype;}public String getAuthcode() {return authcode;}public void setAuthcode(String authcode) {this.authcode = authcode;}public String getAvsreply() {return avsreply;}public void setAvsreply(String avsreply) {this.avsreply = avsreply;}public String getCvv2reply() {return cvv2reply;}public void setCvv2reply(String cvv2reply) {this.cvv2reply = cvv2reply;}public String getDeclinestr() {return declinestr;}public void setDeclinestr(String declinestr) {this.declinestr = declinestr;}public String getCardtype() {return cardtype;}public void setCardtype(String cardtype) {this.cardtype = cardtype;}public String getCardname() {return cardname;}public void setCardname(String cardname) {this.cardname = cardname;}public String getFirst6() {return first6;}public void setFirst6(String first6) {this.first6 = first6;}public String getLast4() {return last4;}public void setLast4(String last4) {this.last4 = last4;}public String getKeyed() {return keyed;}public void setKeyed(String keyed) {this.keyed = keyed;}public String getExpmonth() {return expmonth;}public void setExpmonth(String expmonth) {this.expmonth = expmonth;}public String getExpyear() {return expyear;}public void setExpyear(String expyear) {this.expyear = expyear;}public String getApprovedamt() {return approvedamt;}public void setApprovedamt(String approvedamt) {this.approvedamt = approvedamt;}public String getTip() {return tip;}public void setTip(String tip) {this.tip = tip;}public String getBal() {return bal;}public void setBal(String bal) {this.bal = bal;}public String getInvoiceno() {return invoiceno;}public void setInvoiceno(String invoiceno) {this.invoiceno = invoiceno;}public String getCorporatecardindicator() {return corporatecardindicator;}public void setCorporatecardindicator(String corporatecardindicator) {this.corporatecardindicator = corporatecardindicator;}public String getProcessor_token() {return processor_token;}public void setProcessor_token(String processor_token) {this.processor_token = processor_token;}public String getTest_checkbox() {return test_checkbox;}public void setTest_checkbox(String test_checkbox) {this.test_checkbox = test_checkbox;}public HashMap<String, String> getUserfield() {return userfield;}public void setUserfield(HashMap<String, String> userfield) {this.userfield = userfield;}}Sample Code
12345678910111213141516171819202122232425262728// Set the request parameter.CheckSessionRequest request=new CheckSessionRequest();request.setUsername("1032");request.setPassword("289075");request.setSessionid("B0625D4FF1783B493AF0D67F8F8777F55A50B49D");request.setWait("5");request.setWaitforcompleted("yes");HashMap hashMap=new HashMap<String, String>();hashMap.put("key1", "");hashMap.put("key2","");request.setUserfield(hashMap);new SessionCheckSession().getCheckSession(request,new CheckSessionCallback() {@Overridepublic void getCheckSessionReply(CheckSessionReply 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.
12345678910111213141516171819202122232425262728293031323334<!--?xml version="1.0" encoding="utf-8" ?-->Success0OK/soft/checksession.asp6D625300CCB3FB7FB0D309B74570F4BE3CD10EE1yesY079957787SALETAS249OKVVisa4444559999Yes08131000<processor_token/><test_checkbox>1noIf 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 CreateSession
Remarks
- CheckSession has options that can:
- Specify how long to wait on the SLIM CD servers waiting for an answer.
- Specify if intermediate results should be returned, or only the “final” completed result.
- Identify any other session fields to return as part of the request, including form fields or fields passed to CreateSession
- Remarks Go here
- URL
123https://stats.slimcd.com/soft/json/jsonscript.asp?service=CheckSession
Protocols
- HTTP POST
- HTTP GET
This function accepts either name/value pairs or JSON
Request
Reply
12345678910111213141516171819202122232425262728293031323334353637{"reply":{"response": "Success","responsecode": "0","description": "OK","responseurl": "/soft/CheckSession.asp","datablock": {"sessionid": "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439","completed": "yes","approved": "Y","declinecount": "0","gateid": "78652455","transtype": "SALE","authcode": "TAS981","avsreply": null,"cvv2reply": null,"declinestr": "OK","cardtype": "V","cardname": "Visa","first6": "444455","last4": "9999","keyed": "Yes","expmonth": "07","expyear": "13","approvedamt": "10","tip": "0","bal": "0","invoiceno": null,"corporatecardindicator": null,"processor_token": null,"test_checkbox": "1","userfield": "value"}}}Sample Code
Remarks
- None