当前位置: 代码迷 >> Paypal >> 简略的PHP与PAYPAL的演示
  详细解决方案

简略的PHP与PAYPAL的演示

热度:6593   发布时间:2013-02-26 00:00:00.0
简单的PHP与PAYPAL的演示
    <html>      <head>      <title>Test Paypal</title>      <meta http-equiv="Content-Type" content="text/html; charset=gb2312">      </head>      <body>      <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank" id="book1">      <input type="text" name="item_name" value="Test Papers">      <input type="text" name="amount" value="0.99">      <input type="text" name="quantity" value="1">      <input type="hidden" name="cmd" value="_cart">      <input type="hidden" name="add" value="1">      <input type="hidden" name="business" value="jasmin_1246618940_biz@gmail.com">      <input type="hidden" name="cancel_return" value="http://localhost/test/Papers.php">      <input type="hidden" name="lc" value="US">      <input type="hidden" name="item_name" value="Paper Item">      <input type="hidden" name="amount" value="0.99">      <input type="hidden" name="currency_code" value="USD">      <input type="hidden" name="return" value="http://localhost/test/backdeal.php">      <input type="hidden" name="no_note" value="1">      <input type="hidden" name="no_shipping" value="1">      <input type="hidden" name="rm" value="2">      <input type="hidden" name="cbt" value="download the Papers">      <input type="hidden" name="item_number" value="233223">      <input type="submit" value="Add Cart"/>      </form>      </body>      </html>  

?

?

backdeal.php

?

    <?php      $paper_id = $_POST['item_number1'];      $num_cart_items = $_POST['num_cart_items'];      $status = $_POST['payment_status'];      if ($status == "Completed") {      //付费成功,在此情况下发货是安全的。      echo "Success";      }      elseif ($status == "Pending") {      //款项在途,目前Paypal有可能出现状态为Pending,实际上已经支付成功的情况。      echo $_POST['pending_reason'];            }      //输出$_POST的所有数据。      foreach($_POST as $key => $value)      {        echo "POST Data: $key -> $value <br>";       }      ?>  
?

?

?