473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 6814
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

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

Similar topics

0
by: rgparkins | last post by:
HI I have 2 problems, 1 of which is tied to PHP and 1 loosely tied, so I'll put this out there. Got a problem that I have been working on for a while now which involves implementing the...
1
by: khawar | last post by:
my application is in asp.net using C# hi guys having a complicated problem i am using payflowlink to process CC payments I have to send a httppost to their servers. The problem is how do i do a...
3
by: Tom | last post by:
Hi. After I got some information from the user I need to POST it in XML format to the server NOT MY SERVER - a server at https://xxxx.xxx and to reveive the response. Please let me know...
10
by: Mark | last post by:
Hi All, I could do with some assistance... I am working on an ecommerce site in vb.net (aspx) I have built all my pages that perform the checkout process and gets to a summary screen where you...
2
by: Vishal | last post by:
Hello, I am posting some credit card info to the payment server via a similar code. My code is written in VB.NET but uses the same approach. At the end however I do a...
3
by: Yourself | last post by:
Hi, I'm trying to post data to PayPal for a shopping cart, basically I want to replicate a form like the following, but create the variables dynamically from code behind: <form...
3
by: David Veeneman | last post by:
I am creating a form on the server that I want to POST to a URL that's being called with Server.Transfer(). What's the simplest way to do that? A little background: I'm programming buttons that...
4
by: David Veeneman | last post by:
I want to programmatically create some POST data on a web server, then pass that data to another web page that the server calls, using Server.Transfer(). What's the best way to do that? I'm...
2
by: hagenaer | last post by:
Hello, I'm building a simple shopping cart to work with PayPal. I'd like to have the user post his basket to my page, validate the input, then redirect him _with his validated form data_ to...
3
by: =?UTF-8?B?R8O2cmFuIEFuZGVyc3Nvbg==?= | last post by:
bruce barker wrote: It doesn't have to, as html does. The OP is using a regular htlm form, not a ASP.NET server control form. -- Göran Andersson _____ http://www.guffa.com
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.