I am testing the moneris gateway payment, by using the testing site for CA.
https://esqa.moneris.com/mpg/
Coding is in asp.net C#, with .Net 4.5.1
Just trying a simple purchase from online, but it returns error below:
CardType: null;TransAmount: null;TxnNumber: null;ReceiptId: Global Error Receipt;TransType: null;ReferenceNum: null;ResponseCode: null;ISO: null;BankTotals: ;Message: The request was aborted: Could not create SSL/TLS secure channel.;AuthCode: null;Complete: false;TransDate: null;TransTime: null;Ticket: ;TimedOut: null;IsVisaDebit: ;
Coding is as below:
public string Paying(string stdid) {
string sresult = ""; string order_id = "AC" + DateTime.Now.ToString("yyyyMMddhhmmss"); string store_id = "store5"; string api_token = "yesguy"; string amount = "7.00"; string pan = "4242424242424242"; string expdate = "1901"; //YYMM format string crypt = "7"; string processing_country_code = "CA"; bool status_check = false;
Purchase purchase = new Purchase(); purchase.SetOrderId(order_id); purchase.SetAmount(amount); purchase.SetPan(pan); purchase.SetExpDate(expdate); purchase.SetCryptType(crypt); purchase.SetDynamicDescriptor("Simple payment");
HttpsPostRequest mpgReq = new HttpsPostRequest(); mpgReq.SetProcCountryCode(processing_country_code); mpgReq.SetTestMode(true); //false or comment out this line for production transactions mpgReq.SetStoreId(store_id); mpgReq.SetApiToken(api_token); mpgReq.SetTransaction(purchase); mpgReq.SetStatusCheck(status_check); mpgReq.Send();
try {Moneris.Receipt receipt = mpgReq.GetReceipt(); sresult = "CardType: " + receipt.GetCardType() + ";"; sresult += "TransAmount: " + receipt.GetTransAmount() + ";"; sresult += "TxnNumber: " + receipt.GetTxnNumber() + ";"; sresult += "ReceiptId: " + receipt.GetReceiptId() + ";"; sresult += "TransType: " + receipt.GetTransType() + ";"; sresult += "ReferenceNum: " + receipt.GetReferenceNum() + ";"; sresult += "ResponseCode: " + receipt.GetResponseCode() + ";"; sresult += "ISO: " + receipt.GetISO() + ";";
sresult += "BankTotals: " + receipt.GetBankTotals() + ";"; sresult += "Message: " + receipt.GetMessage() + ";"; sresult += "AuthCode: " + receipt.GetAuthCode() + ";"; sresult += "Complete: " + receipt.GetComplete() + ";"; sresult += "TransDate: " + receipt.GetTransDate() + ";";
sresult += "TransTime: " + receipt.GetTransTime() + ";"; sresult += "Ticket: " + receipt.GetTicket() + ";"; sresult += "TimedOut: " + receipt.GetTimedOut() + ";"; sresult += "IsVisaDebit: " + receipt.GetIsVisaDebit() + ";";
sresult = sresult;
} catch (Exception e) { sresult = e.Message ; }
return sresult; }
I searched and tried around, but still no luck.
Can anyone help?
Thanks.
In reply to Herman: