469,360 Members | 1,775 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

Post ASP.net Web Form to paypal

ak1dnar
1,584 Expert 1GB
Hi,
I need to submit this page to paypal server for processing the postdata string or you can suggest any other way to do this. Can I do this in the code behind somehow(vb)? I've looked at the HttpWebRequest class and still struggling with it.

Expand|Select|Wrap|Line Numbers
  1.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.  
  3.         Dim postdata As String
  4.         postdata = "cmd=_xclick"
  5.         postdata += "&upload=1"
  6.         postdata += "&business=mymail@mail.com"
  7.         postdata += "&return=my_return_Url_goes_Here"
  8.         postdata += "&item_name_1=myitem"
  9.         postdata += "&on0_1=Size"
  10.         postdata += "&amount_1=2.99"
  11. 'I guess this post data string is correct
  12.     End Sub
  13. End Class
  14.  
Jul 5 '07 #1
10 6512
jhardman
3,406 Expert 2GB
moved to .net forum .
Jul 12 '07 #2
Plater
7,872 Expert 4TB
I would shy away from doing things involving money transfer in the background.
Seems very sketchy.

You could look into popping it up in a new window if you don't want your users to leave the website to do it
Jul 12 '07 #3
Frinavale
9,735 Expert Mod 8TB
I would shy away from doing things involving money transfer in the background.
Seems very sketchy.

You could look into popping it up in a new window if you don't want your users to leave the website to do it
From what I understand of PayPal is that the user must go to PayPal's site (unless you get the PayPal Pro package that is only available to USA citizens).

I think there's a way to arrange the web page that they give you so that it looks like it's part of your website...but you're still going to have to direct the user to PayPal's services.

I could be wrong about this though. It's been a while since I've looked at PayPal's services.
Jul 13 '07 #4
ak1dnar
1,584 Expert 1GB
This is the way of using paypal sandbox account to test the transaction with paypal before you go with live paypal account.

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <form id="payForm" method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
  4. <input type="hidden" name="cmd" value="_xclick"> 
  5. <input type="hidden" name="business" value="my_paypal_account@mail.com">
  6. <input type="hidden" name="item_name" value="Registration fee"> 
  7. <input type="hidden" name="amount" value="100.00">
  8. <input type="hidden" name="no_shipping" value="1"> 
  9. <input type="hidden" name="return" value="http://192.168.1.9:5000/MyWebSite/CRS/IPG/confirmation.aspx">
  10. <input type="hidden" name="rm" value="2"> 
  11. <input type="hidden" name="cancel_return" value="http://192.168.1.9:5000/MyWebSite/CRS/IPG/aborted.aspx">
  12. <input type="hidden" name="currency_code" value="USD"> 
  13.  
  14.  
  15. <input name="Submit" type="submit" class="butons" value="Proceed to Paypal" id="Submit1">
  16. </form>
  17.  
  18.  
What I need to do,Post the same form elements with the values to this https://www.sandbox.paypal.com/cgi-bin/webscr
URL for processing.

Only thing I need to know, how to submit the parameters to the paypal server with out using HTML form.
Thanks!
Jul 16 '07 #5
Plater
7,872 Expert 4TB
You should be able to generate the content string for use with the HttpWebRequest object.
Foreach element it goes:
NAME=VALUE<newline>
Jul 16 '07 #6
ak1dnar
1,584 Expert 1GB
You should be able to generate the content string for use with the HttpWebRequest object.
Foreach element it goes:
NAME=VALUE<newline>
Sorry, I didn't get that.
Jul 16 '07 #7
Plater
7,872 Expert 4TB
If it really is supposed to be post data, the format is like this for HttpWebRequest:
Expand|Select|Wrap|Line Numbers
  1.         Dim postdata As String
  2.         postdata = "cmd=_xclick\r\n"
  3.         postdata += "upload=1\r\n"
  4.         postdata += "business=mymail@mail.com\r\n"
  5.         postdata += "return=my_return_Url_goes_Here\r\n"
  6.         postdata += "item_name_1=myitem\r\n"
  7.         postdata += "on0_1=Size\r\n"
  8.         postdata += "amount_1=2.99\r\n"
  9.  
Although it still seems sneaky what you're up to
Jul 16 '07 #8
ak1dnar
1,584 Expert 1GB
Hi,
I need to submit this page to paypal server for processing the postdata string or you can suggest any other way to do this. Can I do this in the code behind somehow(vb)? I've looked at the HttpWebRequest class and still struggling with it.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.  
  3. Dim postdata As String
  4. postdata = "cmd=_xclick"
  5. postdata += "&upload=1"
  6. postdata += "&business=mymail@mail.com"
  7. postdata += "&return=my_return_Url_goes_Here"
  8. postdata += "&item_name_1=myitem"
  9. postdata += "&on0_1=Size"
  10. postdata += "&amount_1=2.99"
  11. 'I guess this post data string is correct
  12. End Sub
  13. End Class
  14.  
When user clicks the button I need to submit postdata string to
This URL for processing...
https://www.sandbox.paypal.com/cgi-bin/webscr

And at the same time my web site shoul redirect to this URL.

Example:
http://www.netomatix.com/HttpPostData.aspx
Jul 16 '07 #9
Plater
7,872 Expert 4TB
Well I gave you the correct construct for the postdata string.
Using the & must be something that the class object interprets and converts to newlines.

I just dug into the paypal stuff. Not sure you can do what you're hoping with that. Looks like the sandbox is JUST for sandbox testing from itself.
Actually I didn't find anything really usefull at all after creating a sandbox account, other then seeing what things would look like.
There seemed to be some sort of special API package you had to purchse/setup to do that kinda stuff.

I did find direct emailable links for donations:
Expand|Select|Wrap|Line Numbers
  1. string n="https://www.sandbox.paypal.com/cgi-bin/webscr?";
  2.             n+="cmd=_xclick";
  3.             n += "&business="+URLEncodedEmailAddress;
  4.             n += "&amount=10%2e00";
  5.             n += "&no_shipping=0";
  6.             n += "&no_note=1&tax=0";
  7.             n += "&currency_code=USD";
  8.             n += "&lc=US";
  9.             n += "&bn=PP%2dDonationsBF";
  10.             n += "&charset=UTF%2d8";
  11.  
And that would be sent to the create of HttpWebRequest.
But that doesn't solve the need for them to log in.
Jul 16 '07 #10
ak1dnar
1,584 Expert 1GB
Well I gave you the correct construct for the postdata string.
Using the & must be something that the class object interprets and converts to newlines.

I just dug into the paypal stuff. Not sure you can do what you're hoping with that. Looks like the sandbox is JUST for sandbox testing from itself.
Actually I didn't find anything really usefull at all after creating a sandbox account, other then seeing what things would look like.
There seemed to be some sort of special API package you had to purchse/setup to do that kinda stuff.

I did find direct emailable links for donations:
Expand|Select|Wrap|Line Numbers
  1. string n="https://www.sandbox.paypal.com/cgi-bin/webscr?";
  2.             n+="cmd=_xclick";
  3.             n += "&business="+URLEncodedEmailAddress;
  4.             n += "&amount=10%2e00";
  5.             n += "&no_shipping=0";
  6.             n += "&no_note=1&tax=0";
  7.             n += "&currency_code=USD";
  8.             n += "&lc=US";
  9.             n += "&bn=PP%2dDonationsBF";
  10.             n += "&charset=UTF%2d8";
  11.  
And that would be sent to the create of HttpWebRequest.
But that doesn't solve the need for them to log in.
Hi,
If you want to test your paypal transaction over sandbox you have to log into your account and let it to run in separate window while you testing Your Application.
Anyway its not a requirement for original paypal account, its only for Testing account.

Could you please show me the code for how to use HttpWebRequest.
-Thanks!
Jul 17 '07 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by rgparkins | last post: by
3 posts views Thread by Tom | last post: by
10 posts views Thread by Mark | last post: by
2 posts views Thread by Vishal | last post: by
3 posts views Thread by Yourself | last post: by
3 posts views Thread by David Veeneman | last post: by
4 posts views Thread by David Veeneman | last post: by
3 posts views Thread by =?UTF-8?B?R8O2cmFuIEFuZGVyc3Nvbg==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.