最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

paypal即時(shí)到賬php實(shí)現(xiàn)代碼

 更新時(shí)間:2010年11月28日 15:24:01   作者:  
paypal即時(shí)到賬php實(shí)現(xiàn)代碼,需要的朋友可以參考下。
http://paypal.ebay.cn/integrationcenter/list__resource_2.html

中文php開(kāi)發(fā)簡(jiǎn)介:http://www.paypal-china.org/wangzhai/197.html
以下是ecshop中paypal的支付代碼

這段代碼是向paypal支付接口提交的
{{{

<form target="_blank" method="post" action="https://www.paypal.com/cgi-bin/webscr" style="text-align: center;"><input type="hidden" value="_xclick" name="cmd"/><input type="hidden" value="xfuajiao@hotmail.com" name="business"/> //商家注冊(cè)的郵箱
<input type="hidden" value="2009102370175" name="item_name"/><input type="hidden" value="2888.00" name="amount"/><input type="hidden" value="USD" name="currency_code"/><input type="hidden" value="http://127.0.0.1/ecshop/respond.php?code=paypal" name="return"/><input type="hidden" value="3" name="invoice"/><input type="hidden" value="utf-8" name="charset"/><input type="hidden" value="1" name="no_shipping"/><input type="hidden" value="" name="no_note"/><input type="hidden" value="http://127.0.0.1/ecshop/respond.php?code=paypal" name="notify_url"/><input type="hidden" value="2" name="rm"/><input type="hidden" value="http://127.0.0.1/ecshop/" name="cancel_return"/><input type="submit" value="立即使用 paypal 支付"/></form>

}}}

以下是官方提供的,接受到paypal傳回來(lái)的參數(shù)的,并且判斷是否支付成功。

支持成功后由于提交表單中有


<input type="hidden" value="http://127.0.0.1/ecshop/respond.php?code=paypal" name="return"/>

paypal將會(huì)主動(dòng)跳轉(zhuǎn)到espond.php?code=paypal這個(gè)頁(yè)面,頁(yè)面可現(xiàn)實(shí)以下POST得到的一些數(shù)據(jù)。



復(fù)制代碼 代碼如下:

// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];

if (!$fp) {
// HTTP ERROR
else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}
?>

相關(guān)文章

最新評(píng)論

都安| 绥棱县| 温泉县| 四平市| 勐海县| 芜湖县| 余庆县| 河津市| 铁岭市| 吴桥县| 繁峙县| 观塘区| 龙南县| 荥阳市| 五常市| 永宁县| 前郭尔| 措勤县| 堆龙德庆县| 商河县| 正蓝旗| 建德市| 定远县| 徐汇区| 肃北| 琼结县| 闽侯县| 高邮市| 化隆| 潜江市| 太仓市| 加查县| 滁州市| 北辰区| 遂溪县| 酉阳| 九江市| 肃南| 阿坝县| 辰溪县| 华宁县|