Re: Post Data to PayPal from Code Behind
- From: "Yourself" <invalid@xxxxxxxxxxxxx>
- Date: Fri, 20 Oct 2006 16:00:42 GMT
Thanks for the tip, I had thought about using the querystring to pass the
data, but I was hoping to avoid it, as it makes it even easier to change the
prices etc.
Am I correct in thinking that there is no possible way of posting data to an
external URL from code behind AND redirecting the user?
If so, I think I will stick to my iframe technique, and work out a way of
getting data between the PayPalForm.aspx and the Checkout.ascx - possibly
using ViewState?
"Superman" <brenton@xxxxxxxxxxxx> wrote in message
news:1161359242.434471.225920@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Yourself,
You're on the right track. Rather than making a post to the paypal
script, you should put all your stuff in a querystring, redirect to
that URL. There are a few ways to integrate into paypal, you can either
use the my website to their website and back to mine (standard), or
call their web services from your website (pro/premium).
My guess is that you just need to package all of that stuff into the
query string and redirect the browser to the url.
ex:
https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=seller@xxxxxxxxxxxxxxxxxxxx
Don't forget to check out the paypal sandbox for testing.
http://www.sandbox.paypal.com
Good luck!
~Brenton MCSD.NET
Yourself wrote:
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 action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business"
value="seller@xxxxxxxxxxxxxxxxx">
<input type="hidden" name="item_name"
value="Aggregated items">
<input type="hidden" name="amount" value="3.00">
<input type="submit" value="PayPal">
</form>
How can I create the hidden input variables in a code behind file and
have
the data posted to https://www.paypal.com/cgi-bin/webscr and the user
redirected to that site?
I'm using the .NET 2 framework, but I still can't figure this out.
The only way I've been able to get somewhere is to have a PayPalForm.aspx
file which is displayed in an iframe (inside a checkout user control),
and
has the following code:
<form name="paypalform" id="paypalform"
action="https://www.paypal.com/cgi-bin/webscr" method="post"
target="_top">
<asp:PlaceHolder ID="pchMain" runat="server"></asp:PlaceHolder>
</form>
Then, in the PayPalForm.aspx.cs file, I can add the hidden input
variables
to the placeholder.
The problem with this approach though, is I need to access other controls
(a
radio button list) that are on the checkout.ascx file which the iframe
sits
on.
So I have:
Checkout.ascx
Radio Button List
Iframe
PayPalForm.aspx
and I need to access the radio button list from within PayPalForm.aspx.cs
Does that make sense??!!
.
- References:
- Post Data to PayPal from Code Behind
- From: Yourself
- Re: Post Data to PayPal from Code Behind
- From: Superman
- Post Data to PayPal from Code Behind
- Prev by Date: Re: Why is cache disappearing?
- Next by Date: Re: Need help: Call server side Stored Procedure and get the retur
- Previous by thread: Re: Post Data to PayPal from Code Behind
- Next by thread: Re: Post Data to PayPal from Code Behind
- Index(es):