locked
Paypal - Receiving payments RRS feed

  • Question

  • User1723144493 posted

     I'm a newbie

    I am trying to set up a method of receiving payments such as Paypal

    I have struggled with this for a couple of days

    I have used this paypal button

    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="bob@domain.com">
    <input type="hidden" name="lc" value="US">
    <input type="hidden" name="item_name" value="Widget">
    <input type="hidden" name="amount" value="100.00">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="bn"
      value="PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest">
    <asp:ImageButton ID="ImageButton1" runat="server"
      ImageUrl="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"
      PostBackUrl="https://www.paypal.com/cgi-bin/webscr" />
     
    But I cant define the values of the hidden fields (dont want to use JavaScript)
     
    I have used ASP Hidden fields - but paypal does not seem to extract the values when you are transfered to their site 
    I would like a straight forward solution - I have tried SDKs and integration wizards on the paypal x developer site - but this is too complex
    Is there a better way to recieve payments from an ASP.net site?
    Is there an easy to integrate method of receiving credit card details (worldpay etc) - which is the best suited to ASP.net?
    The paypal button using the code above would be perfect, if I could set the value of the input below.  I believe this is possible 
    with Java script, but I am not familiar with this and I am told there may be browser issues 
    <input type="hidden" name="amount" value="100.00">
     
     
    Thursday, November 18, 2010 5:48 PM

Answers

  • User1903768026 posted

    HI,

     

    After yout order is complete and user click on button for payment (paypal). write the below code on click on payment button:-

    Response.Redirect("Paypal.aspx?" + "business=" + objDb.paypalemailid + "&quantity=" + Qty + " &item_name=" + prodname + "&item_number=" + ID + "&amount=" + Rate + "&no_shipping=1&return=" + objDb.UrlBasePay() + "Thanks.aspx&cancel_return=" + objDb.UrlBasePay() + "OrderFood.aspx&notify_url=" + str + "&cn=How+did+you+hear+about+us%3F&currency_code=GBP");

     

    This is code for Paypal.aspx

     

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Paypal.aspx.cs" Inherits="Paypal" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>  Payment   </title>
    </head>
    <body>
        <%--<form action="<%= Connect.PayPalRequestPath %>" method="post" name="PayPalForm">--%> <%-- <%=System.Web.Configuration.WebConfigurationManager.AppSettings["PayPalRequestPath"] %>--%>
      
      <form action="<%=System.Web.Configuration.WebConfigurationManager.AppSettings["PayPalRequestPath"] %>"
      method="post" name="PayPalForm">
      <input type="hidden" name="cmd" value="_xclick" />
      <input type="hidden" name="business" value="<%= Request.QueryString["business"]%>" />
       <input type="hidden" name="quantity" value="<%=Request.QueryString["quantity"]%>" />
       <input type="hidden" name="item_name" value="<%=Request.QueryString["item_name"]%>" />
       <input type="hidden" name="item_number" value="<%=Request.QueryString["item_number"]%>"/>
       <input type="hidden" name="amount"  value="<%=Request.QueryString["amount"]%>"/>
       <input type="hidden" name="no_shipping" value="<%=Request.QueryString["no_shipping"]%>" />
       <input type="hidden" name="return"  value="<%=Request.QueryString["return"]%>?item_number=<%=Request.QueryString["item_number"]%>" />
       <input type="hidden" name="cancel_return" value="<%=Request.QueryString["cancel_return"]%>" />
       <input type="hidden" name="notify_url"  value="<%=Request.QueryString["notify_url"]%>" />
       <input type="hidden" name="cn"  value="<%=Request.QueryString["cn"]%>" />
       <input type="hidden" name="currency_code" value="<%=Request.QueryString["currency_code"]%>" />     
      </form>
       <script type="text/javascript" language="JavaScript">
      document.PayPalForm.submit(); 
    </script>

    <html

    </body>
    </html>

     

     

     

    I think this should soulve your problem, If any query let me know.

     

    bye

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 19, 2010 8:41 AM

All replies

  • User1903768026 posted

    HI,

     

    After yout order is complete and user click on button for payment (paypal). write the below code on click on payment button:-

    Response.Redirect("Paypal.aspx?" + "business=" + objDb.paypalemailid + "&quantity=" + Qty + " &item_name=" + prodname + "&item_number=" + ID + "&amount=" + Rate + "&no_shipping=1&return=" + objDb.UrlBasePay() + "Thanks.aspx&cancel_return=" + objDb.UrlBasePay() + "OrderFood.aspx&notify_url=" + str + "&cn=How+did+you+hear+about+us%3F&currency_code=GBP");

     

    This is code for Paypal.aspx

     

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Paypal.aspx.cs" Inherits="Paypal" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>  Payment   </title>
    </head>
    <body>
        <%--<form action="<%= Connect.PayPalRequestPath %>" method="post" name="PayPalForm">--%> <%-- <%=System.Web.Configuration.WebConfigurationManager.AppSettings["PayPalRequestPath"] %>--%>
      
      <form action="<%=System.Web.Configuration.WebConfigurationManager.AppSettings["PayPalRequestPath"] %>"
      method="post" name="PayPalForm">
      <input type="hidden" name="cmd" value="_xclick" />
      <input type="hidden" name="business" value="<%= Request.QueryString["business"]%>" />
       <input type="hidden" name="quantity" value="<%=Request.QueryString["quantity"]%>" />
       <input type="hidden" name="item_name" value="<%=Request.QueryString["item_name"]%>" />
       <input type="hidden" name="item_number" value="<%=Request.QueryString["item_number"]%>"/>
       <input type="hidden" name="amount"  value="<%=Request.QueryString["amount"]%>"/>
       <input type="hidden" name="no_shipping" value="<%=Request.QueryString["no_shipping"]%>" />
       <input type="hidden" name="return"  value="<%=Request.QueryString["return"]%>?item_number=<%=Request.QueryString["item_number"]%>" />
       <input type="hidden" name="cancel_return" value="<%=Request.QueryString["cancel_return"]%>" />
       <input type="hidden" name="notify_url"  value="<%=Request.QueryString["notify_url"]%>" />
       <input type="hidden" name="cn"  value="<%=Request.QueryString["cn"]%>" />
       <input type="hidden" name="currency_code" value="<%=Request.QueryString["currency_code"]%>" />     
      </form>
       <script type="text/javascript" language="JavaScript">
      document.PayPalForm.submit(); 
    </script>

    <html

    </body>
    </html>

     

     

     

    I think this should soulve your problem, If any query let me know.

     

    bye

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 19, 2010 8:41 AM
  • User1723144493 posted

    Thankyou - this solved my problem 

    Thursday, November 25, 2010 8:45 AM