Hi guys I have a problem.
Now, I try to implement payment module within my project.
So they send samples for implements like this.
<%
String hashstr = clientId + oid + amount + okUrl + failUrl + islemtipi + taksit + rnd + storekey;
System.Security.Cryptography.SHA1 sha = new System.Security.Cryptography.SHA1CryptoServiceProvider();
byte[] hashbytes = System.Text.Encoding.GetEncoding("ISO-8859-9").GetBytes(hashstr);
byte[] inputbytes = sha.ComputeHash(hashbytes);
String hash = Convert.ToBase64String(inputbytes);
%>
<form action="xxxxx" method="POST">
<input type="hidden" name="clientid" value="<%=clientId%>">
<input type="hidden" name="amount" value="<%=amount%>">
<input type="hidden" name="oid" value="<%=oid%>">
<input type="hidden" name="okUrl" value="<%=okUrl%>" >
<input type="hidden" name="failUrl" value="<%=failUrl%>" >
<input type="hidden" name="rnd" value="<%=rnd%>" >
<input type="hidden" name="hash" value="<%=hash%>" >
<input type="hidden" name="storetype" value="3d_pay_hosting" >
<input type="submit" name="submit" value="Send">
</form>
So this code run very well when I press the button my page direct to bank page and than in there customer charges the money after that it return my okUrl.
But my problem I have to use this code in page which under the master page and there are many button in this web page. How can I perform this scenario very well.
Some code samples that I search on the internet says you have to use WebRequest like this.
StringBuilder builderValues = new StringBuilder();
builderValues.Append("&okUrl=" + "http://xxx.com/Payment/" + oid);
builderValues.Append("&failUrl=" + "http://xxx.com/Failed/" + oid);
builderValues.Append("&storetype=3d_pay_hosting");
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = builderValues.ToString();
byte[] data = new ASCIIEncoding().GetBytes(postData);
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("xxx");
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
httpWebRequest.ContentLength = data.Length;
Stream dataStream = httpWebRequest.GetRequestStream();
dataStream.Write(data, 0, data.Length);
HttpWebResponse response = (HttpWebResponse)httpWebRequest.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
String responseString = reader.ReadToEnd();
dataStream.Close();
But that time my page would not redirect to bank page for charges cost.
Can you give some help or suggestion please.
Thanks.