paypal iPN 案例未在 paypal 中调用“立即付款”

发布于 2024-11-17 18:45:15 字数 2234 浏览 2 评论 0原文

paypal iPN 案例不是在 paypal 中调用“立即付款”。 在 paypal 按钮中进行以下设置。

return : "http://localhost/paypal.php?ch=return"

cancel_return : "cancel_return" value="http://localhost/paypal.php?ch=cancel"

notify_url : value="http://localhost/paypal.php?ch=ipn"

paypal_form.php

<form name="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="no_notes" value="1">
<input type="hidden" name="custom" value="1">
<input type="hidden" name="business" value="[email protected]">

<input type="hidden" name="return" id="return" value="http://localhost/paypal.php?ch=return">
<input type="hidden" name="cancel_return" id="cancel_return" value="http://localhost/paypal.php?ch=cancel">
<input type="hidden" name="notify_url" id="notify_url" value="http://localhost/paypal.php?ch=ipn">
<input type="image" src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_GB/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_GB/i/scr/pixel.gif" width="1" height="1">

贝宝.php

<?

include('db_connect.php');

$choice=isset($_GET['ch'])?$_GET['ch']:'';


switch($choice){

case 'return':
        print "Thank You For Buying this product,Please Visit Again,If is there any complements Then suggest us..";
    break;
case 'ipn':
    $sql="INSERT INTO paypal(add_date) VALUES(now())";
    mysql_query($sql);

    $x = fopen('test1.txt','w+');
    $str2 = 'post data:dfydfhgfhjg'; 
    foreach($_POST as $k=>$v){
        $str2 .= $k.'--'.$v;
    }
    fwrite($x,$str2);
    fclose($x);

    break;
case 'cancel':
        print "Thank You for visiting this site,Please inform your friend to buy products through paypal which is easy service... ";
    break;
}   
?>

paypal ipn case is not calling in paypal "pay now".
In paypal button the following is set.

return : "http://localhost/paypal.php?ch=return"

cancel_return : "cancel_return" value="http://localhost/paypal.php?ch=cancel"

notify_url : value="http://localhost/paypal.php?ch=ipn"

paypal_form.php

<form name="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="no_notes" value="1">
<input type="hidden" name="custom" value="1">
<input type="hidden" name="business" value="[email protected]">

<input type="hidden" name="return" id="return" value="http://localhost/paypal.php?ch=return">
<input type="hidden" name="cancel_return" id="cancel_return" value="http://localhost/paypal.php?ch=cancel">
<input type="hidden" name="notify_url" id="notify_url" value="http://localhost/paypal.php?ch=ipn">
<input type="image" src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_GB/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_GB/i/scr/pixel.gif" width="1" height="1">

paypal.php

<?

include('db_connect.php');

$choice=isset($_GET['ch'])?$_GET['ch']:'';


switch($choice){

case 'return':
        print "Thank You For Buying this product,Please Visit Again,If is there any complements Then suggest us..";
    break;
case 'ipn':
    $sql="INSERT INTO paypal(add_date) VALUES(now())";
    mysql_query($sql);

    $x = fopen('test1.txt','w+');
    $str2 = 'post data:dfydfhgfhjg'; 
    foreach($_POST as $k=>$v){
        $str2 .= $k.'--'.$v;
    }
    fwrite($x,$str2);
    fclose($x);

    break;
case 'cancel':
        print "Thank You for visiting this site,Please inform your friend to buy products through paypal which is easy service... ";
    break;
}   
?>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

余生再见 2024-11-24 18:45:15

IPN 脚本不能驻留在本地主机上,因为 PayPal 会从他们这边打开自己的连接。请改用 FQDN。

An IPN script can't reside on localhost, since PayPal will open its own connection to it from their side. Use a FQDN instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文