Friday 11 January 2013

paypal integration

Create PayPal Account in SandBox to testing


Go to https://developer.paypal.com/ and create Paypal account to be testing

After create new account Login into the developer.paypal.com website. Now click on the Test accounts Right side and create two sub accounts


1) Buyer account

2) Seller account


images

After Click Preconfigured create account for buyer and seller like below
images

After enter all details click Create account button. Now those two accounts are displayed in your test accounts like Business, Personal
images  after that u will create a page  design code

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">
        function y() {
            location.href = "Default.aspx";
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <input type="button"  onclick="y()" />
    </div>
    </form>
</body>
</html>
c# code
 using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["SessionName"]=100.00;
     
    }
}
after that u will create another page  design code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">
        function x() {

            var someSession = '<%= Session["SessionName"].ToString() %>';
            alert(someSession)
            document.getElementById('amount').value = someSession
          
        }
    </script>
</head>
<body onload="x()">
  
   <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
  <input type="hidden" name="cmd" value="_xclick">
  <input type="hidden" name="business" value="business acount name">
  <input type="hidden" name="lc" value="US">
  <input id="iptItemName" type="hidden" name="item_name" value="Total Amount">
  <input type="hidden" name="amount" id="amount">
  <input type="hidden" name="currency_code" value="USD">
  <input type="hidden" name="button_subtype" value="products">
  <input type="hidden" name="no_note" value="0">
  <input type="hidden" name="cn" value="Add special instructions to the seller">
  <input type="hidden" name="no_shipping" value="2">
  <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
  <input type="image"
    src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif"
    border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  <img alt="" border="0"
    src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif"
    width="1" height="1">

</form>
  
</body>
</html>

No comments:

Post a Comment