private string ChargeProtx(CreditCardInfo objCardInfo)
{
System.Net.HttpWebRequest request =
(System.Net.HttpWebRequest) System.Net.HttpWebRequest.Create("https://ukvpstest.protx.com/VSPSimulator/VSPDirectGateway.asp");
request.Method = "POST";
string postData = "VPSProtocol=2.22&" +
"TxType=PAYMENT&" +
"Vendor=vendorname&" +
"VendorTxCode=" + objCardInfo.OrderID + "&" +
"Amount=" + objCardInfo.Amount.ToString().Replace(",",".")+"&"+
"Currency=GBP&" +
"Description=Direct_payment&" +
"CardHolder=" + objCardInfo.FirstName + " " + objCardInfo.LastName + "&" +
"CardNumber=" + objCardInfo.Number + "&";
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(postData);
request.ContentLength = byteArray.Length;
System.IO.Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
System.Net.HttpWebResponse responseX = (System.Net.HttpWebResponse) request.GetResponse();
dataStream = responseX.GetResponseStream();
System.IO.StreamReader reader = new System.IO.StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
responseX.Close();
return responseFromServer;
}
Hope this helps!
No comments:
Post a Comment
Note: only a member of this blog may post a comment.