繁体   English   中英

PayPal IPN 模拟器工作正常,但 IPN 不响应沙箱付款

[英]PayPal IPN simulator works fine but IPN not responding to sandbox payments

如果我从这里发送一个 IPN https://developer.paypal.com/developer/ipnSimulator/它工作正常。

如果我使用 PayPal 沙盒帐户和 PayPal 标准按钮直接从我的网站付款,则 IPN 侦听器不会接收任何内容。 这是我网站上的 PayPal 按钮(请注意,它确实链接到 PayPal 的沙箱,并且正确指定了 notify_url):

                <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
                    <input type="hidden" name="cmd" value="_xclick">
                    <input type="hidden" name="no_shipping" value="1">
                    <input type="hidden" name="no_note" value="1">
                    <input type="hidden" name="currency_code" value="USD">
                    <input type="hidden" name="button_subtype" value="services">

                    <input type="hidden" name="business" value="payments@www.com">
                    <input type="hidden" name="item_number" value="21-2360-4" id="itemNumber">
                    <input type="hidden" name="item_name" value="Listing Fee">
                    <input type="hidden" name="return" value="https://www.com/Market">
                    <input type="hidden" name="cancel_return" value="https://www.com/Seller">
                    <input type="hidden" name="amount" value="10" id="amount">

                    <input type="hidden" name="notify_url" value="https://www.com/IPN">
                    <p><button type="submit" id="sellButton">Pay fee and list</button></p>
                </form>

这是我的 IPN 侦听器代码,它适用于从 PayPal IPN 模拟器页面制作的 IPN,但不适用于使用上述表格进行的沙盒支付(注意它也在侦听 PayPal 的沙盒):

if($_SERVER['REQUEST_METHOD'] != 'POST'){
    exit();
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "cmd=_notify-validate&" . http_build_query($_POST));
$response = curl_exec($ch);
curl_close($ch);

if($response == "VERIFIED"){
     // Successful purchase code.
}

任何关于它为什么不接收 IPN 的线索将不胜感激。

修改信息登录收款人Paypal账户并设置IPN

Steps 个人资料 -> 个人资料和设置 -> 我的销售工具 -> 即时付款通知 -> 更新

点击“选择IPN设置”

将“通知 URL”字段设置为 HTML 表单中“notify_url”上的内容。

选择“接收IPN消息”

节省

注意:如果您检查 IPN 历史记录,它可能会显示为已排队。 这似乎是一个沙盒故障,或者可能是它处理了许多请求并且排起了长队。 您可以尝试小额付款(例如 1 美元)。 请参阅此处: Paypal IPN 状态 - 已排队

现在无关紧要---这应该是评论,但我没有发表评论的权限。 您有<button name="submit">Purchase with PayPal</button>那应该是<button type="submit">Purchase with PayPal</button>请在<form></form> <button type="submit">Purchase with PayPal</button>提供完整的 Paypal html 代码<form></form>标签。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM