Avatar of webguero
webguero

asked on 

How do I do a response.redirect to PayPal instead of PostBack

I am setting up a payment poage for PayPal. If I do  apostBack it works fine. What I want to do is be able to do is a response.redirect so that I can populate my parameteers dynamilcally.

When I try to do a response.redirect, it redirects to paypal fine, but it's like PayPal is not receiving the passed parameteers, I just get a login page, it does not show the passed items, price or my logo like it does when I post the info from the form.

I have included my code below.  Thanks in advance.
Here is the PostBack - this works fine -
    <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="rick@aspdotnetgeeks.com">
   <input type="hidden" name="item_name_1"
      value="Item Name 1">
   <input type="hidden" name="amount_1" value="1.00">
   <input type="hidden" name="item_name_2"
      value="Item Name 2">
   <input type="hidden" name="amount_2" value="2.00">
   <input type="submit" value="PayPal">
 
       
    </form>
 
*************************************************************
 
HERE IS THE RESPONSE.REDIRECT - THIS IS NOT WORKING
 
 
    protected void Page_Load(object sender, EventArgs e){
        Response.Redirect(GetSubmitUrl());
    }
 
    public string GetSubmitUrl()
    {
        StringBuilder url = new StringBuilder();
 
        url.Append(THE_PAYPAL_BASE_URL + "cmd=_cart&business=" +
            THE_BUSINESS_EMAIL);
        url.AppendFormat("&upload={0}", theupload);
        url.AppendFormat("&item_name_1={0}", theitem_name_1);
        url.AppendFormat("&amount_1={0}", theamount_1);
        return url.ToString();
    }
 
THIS IS WHAT IS ACTUALLY BEING PASSED 
 
https://www.paypal.com/cgi-bin/webscr=_cart&business=rkennerson@aspdotnetgeeks.com%20&upload=1&item_name_1=RickTest&amount_1=3);

Open in new window

E-CommerceC#ASP.NET

Avatar of undefined
Last Comment
webguero

8/22/2022 - Mon