SendReceipt
- Method
SlimCD.Transact.SendReceipt
Purpose
Sends a receipt via email or SMS-text.
Description
Email or SMS-Text delivery of receipts is performed with this function. The text for receipts is generated using information on file with SLIM CD, so the receipts match those produced by the SLIM CD website. Receipts for SMS-Text are abbreviated versions that show a simpler version of the data.
Business Rules
Argument List
Name Required Usage SendReceiptRequest 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
SendReceipt 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. GateID integer 12 require Gateway ID for previous transaction. Send_Sms string 3 not require yes/no causes SMS text to be sent if phone number provided Phone integer 20 require Cardholder phone number Send_Email Email string 40 require Cardholder Email address Send_cc string 3 not require yes/no causes SMS text to be sent CC_Email string 100 not require email address of recipient for a carbon-copy of receipt (overrides merchant settings stored on SLIMCD.COM) 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
- email_result
- status
- info
- cc_result
- status
- info
- sms_result
- status
- info
- email_result
Remarks
- General
- Names in name/value pairs are NOT case-sensitive
- Names inside XML tags ARE case-sensitive
- Function-Specific
- None
- reply
- Include
012<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script>
Method
1234function SendReceipt(request,callback)function SendReceipt(request,timeout,callback)
Request
12345678910111213request= {"username": "R6UT8C6M","password": "","gateid": "78022528","send_sms": "no","phone": "","send_email": "no","email": "","send_cc": "no","ccemail": ""}
Reply
123456789101112131415161718192021222324callback ( {"reply": {"response": "Success","responsecode": "0","description": null,"responseurl": "/wswebservices/sendreceipt.asp","datablock": {"email_result": {"status": "NONE","info": null},"cc_result": {"status": "NONE","info": null},"sms_result": {"status": "NONE","info": null}}}} );
Sample Code
1234567891011121314151617181920212223242526<script src="https://trans.slimcd.com/soft/json/slimcd.js">// <![CDATA[<script type="text/javascript" src="https://trans.slimcd.com/soft/json/slimcd.js">// ]]></script><script>// <![CDATA[SlimCD.Sessions.SendReceipt({"username": "R6UT8C6M","password": "","gateid": "78022528","send_sms": "no","phone": "","send_email": "no","email": "","send_cc": "no","ccemail": ""},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
012include 'slimcd.php';
Method
123function Images_SendReceipt(Images_SendReceiptRequest $request,$timeout=false)Request
12345678910111213141516class Images_SendReceiptRequest{// property declarationpublic $username = '';public $password = '';public $gateid=0;public $send_sms='no';public $phone='';public $send_email='no';public $email='';public $send_cc='no';public $ccemail='';}JSON Reply
123456789101112131415161718192021{"response": "Success","responsecode": "0","description": null,"responseurl": "/wswebservices/sendreceipt.asp","datablock": {"email_result": {"status": "NONE","info": null},"cc_result": {"status": "NONE","info": null},"sms_result": {"status": "NONE","info": null}}Sample Code
1234567891011121314151617181920212223242526include 'slimcd.php';// Create the Slim CD object$SlimCD = new SlimCD() ;// Create a GetReceipt Request class$request = new Images_SendReceiptRequest() ;$request->username = 'R6UT8C6M';$request->password = '';$request->gateid=78022528;$request->send_sms='no';$request->phone='';$request->send_email='no';$request->email='';$request->send_cc='no';$request->ccemail='';$result = $SlimCD->Images_SendReceipt($request);if ($result->response == 'Success') {echo 'Success!' ;}else {echo $result->response . ':' . $result->description ;}Downloads
- Include
123using SlimCD;
Method
123public SendReceiptReply SendReceipt(SendReceiptRequest request, int timeout);
Request
1234567891011121314public class SendReceiptRequest{public string username { get; set; }public string password { get; set; }public int gateid { get; set; }public string send_sms { get; set; }public string phone { get; set; }public string send_email { get; set; }public string email { get; set; }public string send_cc { get; set; }public string ccemail { get; set; }}
Reply
1234567891011121314public class SendReceiptReply{public string response;public string responsecode;public string responseurl;public string description;public SendReceiptResult email_result;public SendReceiptResult cc_result;public SendReceiptResult sms_result;public string senddata;public string recvdata;}
Cross Reference: ClientSample Code
1234567891011121314151617181920212223242526SlimCD.Images images = new SlimCD.Images();images.debug = true;images.transURL = TransURL;images.statsURL = StatsURL;SendReceiptRequest request = new SendReceiptRequest();SendReceiptReply reply = new SendReceiptReply();request.username = "R6UT8C6M";request.password = "";request.gateid = 78022528;request.send_sms = "no";request.phone = "";request.send_email = "no";request.email = "";request.send_cc = "no";request.ccemail = "";reply = images.SendReceipt(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
012public async Task SendReceipt(SendReceiptRequest request, int timeout);
Request
1234567891011121314public class SendReceiptRequest{public string username { get; set; }public string password { get; set; }public int gateid { get; set; }public string send_sms { get; set; }public string phone { get; set; }public string send_email { get; set; }public string email { get; set; }public string send_cc { get; set; }public string ccemail { get; set; }}
Reply
1234567891011121314public class SendReceiptReply{public string response;public string responsecode;public string responseurl;public string description;public SendReceiptResult email_result;public SendReceiptResult cc_result;public SendReceiptResult sms_result;public string senddata;public string recvdata;}
Cross Reference: ClientSample Code
1234567891011121314151617181920212223242526SlimCD.Images images = new SlimCD.Images();images.debug = true;images.transURL = TransURL;images.statsURL = StatsURL;SendReceiptRequest request = new SendReceiptRequest();SendReceiptReply reply = new SendReceiptReply();request.username = "R6UT8C6M";request.password = "";request.gateid = 78022528;request.send_sms = "no";request.phone = "";request.send_email = "no";request.email = "";request.send_cc = "no";request.ccemail = "";reply = await images.SendReceipt(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 (^ImagesSendReceiptReplyBlock)(ImagesSendReceiptReply *reply);- (void) imagesSendReceiptWithRequest:(ImagesSendReceiptRequest*)request replyBlock:(ImagesSendReceiptReplyBlock)replyBlock;- (void) imagesSendReceiptWithRequest:(ImagesSendReceiptRequest*)request timeout:(NSTimeInterval)timeout replyBlock:(ImagesSendReceiptReplyBlock)replyBlock;
Request
123456789101112@interface ImagesSendReceiptRequest@property (strong) NSString *userName;@property (strong) NSString *password;@property (strong) NSNumber *gateID;@property (strong) NSString *email;@property (strong) NSString *emailCC;@property (strong) NSString *sms;@end
Reply
123456789@interface ImagesSendReceiptReply : SlimCDReply@property (strong) SendReceiptInfo *emailResult;@property (strong) SendReceiptInfo *ccResult;@property (strong) SendReceiptInfo *smsResult;@endSample Code
1234567891011121314SlimCD *api = [[SlimCD alloc] init];ImagesSendReceiptRequest *request = [[ImagesSendReceiptRequest alloc] init];request.userName = @"1032";request.password = @"289075";request.gateID = @12345;request.email = email;request.sms = @"9542223333";[api imagesSendReceiptWithRequest:request replyBlock:^(ImagesSendReceiptReply *reply ) {if ( reply.responseCode == RC_SUCCESS ){ }}]; -
Method
123<textarea class="doc_code" cols="88" readonly="readonly" rows="1"> public void getSendReceipt(SendReceiptRequest imagesSendReceiptRequest,int timeout, SendReceiptCallback callback)public void getSendReceipt( SendReceiptRequest imagesSendReceiptRequest,SendReceiptCallback callback) </textarea>request
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120<textarea class="doc_code" cols="88" readonly="readonly" rows="10"> public class SendReceiptRequest {//request parameters.private String username ;private String password ;private int gateid ;private String send_sms ;private String phone ;private String send_email ;private String email ;private String send_cc ;private String ccemail ;public SendReceiptRequest(){// set default value.username="";password="";gateid=0;send_cc="";send_email="";send_sms="";phone="";email="";ccemail="";}// 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 getGateid() {return gateid;}public void setGateid(int gateid) {this.gateid = gateid;}public String getSend_sms() {return send_sms;}public void setSend_sms(String send_sms) {this.send_sms = send_sms;}public String getPhone() {return phone;}public void setPhone(String phone) {this.phone = phone;}public String getSend_email() {return send_email;}public void setSend_email(String send_email) {this.send_email = send_email;}public String getEmail() {return email;}public void setEmail(String email) {this.email = email;}public String getSend_cc() {return send_cc;}public void setSend_cc(String send_cc) {this.send_cc = send_cc;}public String getCcemail() {return ccemail;}public void setCcemail(String ccemail) {this.ccemail = ccemail;}}</textarea>Reply
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071<textarea class="doc_code" cols="88" readonly="readonly" rows="1"> public class SendReceiptReply {// server responseprivate SendReceiptResult email_result=null;private SendReceiptResult cc_result=null;private SendReceiptResult sms_result=null;private String response="";private String responsecode="";private String description="";private String responseurl="";private String sentdata="";private String recvdata="";// setter and getters.public SendReceiptResult getEmail_result() {return email_result;}public void setEmail_result(SendReceiptResult email_result) {this.email_result = email_result;}public SendReceiptResult getCc_result() {return cc_result;}public void setCc_result(SendReceiptResult cc_result) {this.cc_result = cc_result;}public SendReceiptResult getSms_result() {return sms_result;}public void setSms_result(SendReceiptResult sms_result) {this.sms_result = sms_result;}public String getSentdata() {return sentdata;}public void setSentdata(String sentdata) {this.sentdata = sentdata;}public String getRecvdata() {return recvdata;}public void setRecvdata(String recvdata) {this.recvdata = recvdata;}public String getResponse() {return response;}public void setResponse(String response) {this.response = response;}public String getResponsecode() {return responsecode;}public void setResponsecode(String responsecode) {this.responsecode = responsecode;}public String getDescription() {return description;}public void setDescription(String description) {this.description = description;}public String getResponseurl() {return responseurl;}public void setResponseurl(String responseurl) {this.responseurl = responseurl;}}</textarea>Sample Code
123456789101112131415161718192021222324252627282930313233<textarea class="doc_code" cols="88" readonly="readonly" rows="20">// To set the request parameter.SendReceiptRequest request=new SendReceiptRequest();request.setUsername("R6UT8C6M");request.setPassword("");request.setGateid(78022528);request.setCcemail("");request.setEmail("");request.setPhone("");request.setSend_cc("");request.setSend_email("");request.setSend_sms("");// To call the web service.new ImagesSendReceipt().getSendReceipt(request, new SendReceiptCallback() {@Overridepublic void getSendReceiptReply(SendReceiptReply reply) {if (reply.getResponse().equals("Success")){textBox.setText("Success");}else{textBox.setText("There was a problem:\n" + reply.getResponse() +"\n Descriptin "+ reply.getDescription());}}});</textarea>Downloads
- URL
Protocols
- SOAP/XML
- HTTP POST
- HTTP GET
Request
Reply
1234567<!--?xml version="1.0" encoding="utf-8" ?-->Success0OKhttps://trans.slimcd.com/wswebservices/transact.asmx/CloseBatchY*875873Status Codes
Status Code Status Description Explanation 200 200 OK All CloseBatch attempts will return XML with this response. 500 500 Internal Server Error The response will not contain XML, as a server error has occurred. Sample Code
code[/tabs]
Remarks- JSON (based on content-type)
Downloads
ONLINE EXERCISER TOOL
- URL
123https://stats.slimcd.com/soft/json/jsonscript.asp?service=SendReceipt
Protocols- HTTP POST
- HTTP GET
This function accepts either name/value pairs or JSON
Request
Reply
123456789101112131415161718192021222324{"reply": {"response": "Success","responsecode": "0","description": null,"responseurl": "/wswebservices/sendreceipt.asp","datablock": {"email_result": {"status": "NONE","info": null},"cc_result": {"status": "NONE","info": null},"sms_result": {"status": "NONE","info": null}}}}Sample Code
Remarks
- None