http://paypal.ebay.cn/integrationcenter/list__resource_2.html
中文php开发简介:http://www.paypal-china.org/wangzhai/197.html
以下是ecshop中paypal的支付代码
这段代码是向paypal支付接口提交的
{{{
//商家注册的邮箱
}}}
以下是官方提供的,接受到paypal传回来的参数的,并且判断是否支付成功。
支持成功后由于提交表单中有
paypal将会主动跳转到espond.php?code=paypal这个页面,页面可现实以下post得到的一些数据。
复制代码 代码如下:
// 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);
}
?>
http://www.bkjia.com/phpjc/322630.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/322630.htmltecharticlehttp://paypal.ebay.cn/integrationcenter/list__resource_2.html 中文php开发简介:http://www.paypal-china.org/wangzhai/197.html 以下是ecshop中paypal的支付代码 这段代码...
