简单的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="[email protected]"> <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>"; } ?>
相关推荐
huha 2020-10-16
TLROJE 2020-10-26
echoes 2020-08-20
nercon 2020-08-01
zhanghaibing00 2020-06-28
Aveiox 2020-06-25
henryzhihua 2020-06-21
zhoutaifeng 2020-06-17
liangzhouqu 2020-06-16
TONIYH 2020-06-11
开心就好 2020-06-10
x青年欢乐多 2020-06-06
KyrieHe 2020-06-03
bertzhang 2020-06-02
haokele 2020-05-29
niehanmin 2020-05-28
davidliu00 2020-05-26