|
-
Jun 27th, 2003, 09:37 PM
#1
Thread Starter
Lively Member
Posting Data to Another URL
Hello,
I am developing an ASP.NET shopping cart that uses PayPal for payment processing. I would like to find a way to post the shopping cart variables to PayPal without displaying them in the URL.
I have been searching for hours without being able to find a solution to this question. It works fine when I pass the variables through the URL, but I don't want my customers to be able to see the variables that I'm passing to PayPal. I'd appreciate any help or advice.
-
Jun 27th, 2003, 10:12 PM
#2
PowerPoster
Doesnt the Session object persist even when navigating out of the site you developed?
I would just store the values in the session.
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Jun 27th, 2003, 10:17 PM
#3
Thread Starter
Lively Member
Session object
Then how do I pass the session variables to PayPal, and how will PayPal process them?
-
Jun 27th, 2003, 11:44 PM
#4
PowerPoster
I have no idea. How exactly do you expect paypal to take your variables? What exactly are you trying to do? I dont really understand. I assumed you were trying to fill in some fields on a paypal page or something...
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Jun 28th, 2003, 01:03 AM
#5
PowerPoster
Are you doing this in your form tag?
method="post"
Also, maybe paypal doesn't support this method. Maybe they only support querystring values (which is what you see in the address bar). You should check with them.
-
Jun 28th, 2003, 04:44 PM
#6
Thread Starter
Lively Member
Sorry, if I wasn't clear earlier. I am just trying to send PayPal the information pertaining the my customer's shopping cart (such as item ID, name, quantity, price, etc.)
I can do it through the URL, but I don't want my customers to be able to see the variables (I don't want anyone trying to change the price or the quantities). I just need to know how to POST the variables without actually putting them in the URL.
-
Jun 28th, 2003, 04:49 PM
#7
Thread Starter
Lively Member
PayPal does support the POST method as I have seen sites that do not use the querystring method to pass shopping cart variables to PayPal.
Can you explain using the Session variable method. I know what they are and how to implement them, but I don't get how storing my customer's shopping cart in session variables allows PayPal to use and process them.
-
Jun 28th, 2003, 05:42 PM
#8
Thread Starter
Lively Member
Well,
I have figured out how to post the data to PayPal (without using the querystring method), but now how do I open the PayPal page for my customers?
Here is my code
Code:
Dim strURL As String = "https://www.paypal.com/xclick/?"""
Dim strRedirect As String = "cmd=_cart"
strRedirect += "&business=" + Server.UrlEncode("[email protected]")
strRedirect += "&invoice=" + Server.UrlEncode(10000) + "&item_name=AME Magazine&item_number=10003"
Dim myWriter As StreamWriter
Dim objRequest As HttpWebRequest = CType(WebRequest.Create(strURL), HttpWebRequest)
objRequest.Method = "POST"
objRequest.ContentLength = strRedirect.Length
objRequest.ContentType = "application/x-www-form-urlencoded"
Try
myWriter = New StreamWriter(objRequest.GetRequestStream())
myWriter.Write(strRedirect)
Catch
'error message
Console.WriteLine(e.ToString)
Finally
myWriter.Close()
End Try
Dim objResponse As HttpWebResponse = CType(objRequest.GetResponse(), HttpWebResponse)
Dim newsr As New StreamReader(objResponse.GetResponseStream())
Dim respText As String = newsr.ReadToEnd()
respText returns the html of the PayPal page but I can't just response.write(respText) because the customer actually has to be redirected to the PayPal page in order for it to work properly.
-
Jun 28th, 2003, 06:25 PM
#9
PowerPoster
Response.Redirect(respText)
-
Jun 28th, 2003, 06:41 PM
#10
Thread Starter
Lively Member
response.redirect(respText) does not work because respText is not a URL, it is the HTML code from the PayPal page.
-
Jun 28th, 2003, 11:54 PM
#11
PowerPoster
Try something like this. (it is from memory, may not be exact)
Dim myLitControl As New LiteralControl()
myLitControl.Text = respText
Me.Controls.Add(myLitControl)
You can also use a placeholder on your page, then add the literalcontrol tot hat placeholder I believe.
-
Jul 2nd, 2003, 02:32 PM
#12
Lively Member
Doesnt paypal have a webservice?
"All those who wonder are not lost" -j.r.r tolkien
-
Jul 2nd, 2003, 05:28 PM
#13
Thread Starter
Lively Member
Thanks Hellswraith, but I know how to display the html string I get from PayPal, I wanted to know if there was a way that I could, not just display the page, but actually redirect my customers to the PayPal page after I POST the values.
As far as I know, robdotnet00, PayPal does not have a webservice.
Anyways, I solved this problem by developing another page that creates a custom form based on the customer's current shopping cart. This is just a regular html form that Posts the hidden variables to the PayPal site.
It's one more page that my customers will have to click through, but at least it works.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|