ASP.NET - How to get transaction details from paypal?

Asked By KCH on 17-Feb-12 04:48 AM
Hi,
Please help me ....
Somesh Yadav replied to KCH on 17-Feb-12 04:52 AM

Hello,

Here is the VB code

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
      Dim str1 As String = TextBox1.Text
      Dim str2 As String = TextBox2.Text

      Dim encoding As New System.Text.ASCIIEncoding()
      Dim postdata As String
      postdata = "str1=" + str1
      postdata += ("&str2=" + str2)
      Dim data() As Byte
      Data = encoding.GetBytes(postdata)
      Dim myRequest As System.Net.HttpWebRequest
      myRequest = CType(System.Net.WebRequest.Create("http://localhost/6.1/Default.aspx"), System.Net.HttpWebRequest)
      myRequest.Method = "POST"
      myRequest.ContentType = "application/x-www-form-urlencoded"
      myRequest.ContentLength = data.Length
      Dim myStream As System.IO.Stream
      myStream = myRequest.GetRequestStream()

      myStream.Write(data, 0, data.Length)
      myStream.Close()

    End Sub

Hope it helps,

KCH replied to Somesh Yadav on 17-Feb-12 04:54 AM
can you please give me c# code...
kalpana aparnathi replied to KCH on 17-Feb-12 05:02 AM
hi,

Use this link:http://www.codeproject.com/Articles/42894/Introduction-to-PayPal-for-C-ASP-NET-developershttp://www.codeproject.com/Articles/42894/Introduction-to-PayPal-for-C-ASP-NET-developers

Regards,
Suchit shah replied to KCH on 17-Feb-12 05:13 AM
Try below and let me know

protected void   Button1_Click(object sender, System.EventArgs e)
{
  string str1 = TextBox1.Text;
  string str2 = TextBox2.Text;
 
  System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
  string postdata = null;
  postdata = "str1=" + str1;
  postdata += ("&str2=" + str2);
  byte[] data = null;
  Data = encoding.GetBytes(postdata);
  System.Net.HttpWebRequest myRequest = default(System.Net.HttpWebRequest);
  myRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://localhost/6.1/Default.aspx");
  myRequest.Method = "POST";
  myRequest.ContentType = "application/x-www-form-urlencoded";
  myRequest.ContentLength = data.Length;
  System.IO.Stream myStream = default(System.IO.Stream);
  myStream = myRequest.GetRequestStream();
 
  myStream.Write(data, 0, data.Length);
  myStream.Close();
 
}
KCH replied to Suchit shah on 17-Feb-12 07:47 AM
Thank u 4 ur reply.....
I have installed SDK's from Paypal and solved the above query....