简体   繁体   English

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

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

If I send an IPN from here https://developer.paypal.com/developer/ipnSimulator/ it works fine.如果我从这里发送一个 IPN https://developer.paypal.com/developer/ipnSimulator/它工作正常。

If I make a payment directly from my site using a PayPal sandbox account and a PayPal standard button, the IPN listener doesn't pick anything up.如果我使用 PayPal 沙盒帐户和 PayPal 标准按钮直接从我的网站付款,则 IPN 侦听器不会接收任何内容。 Here's the PayPal button on my site (note that it does link to PayPal's sandbox and the notify_url is specified correctly):这是我网站上的 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>

Here's my IPN listener code which works fine for IPNs made from the PayPal IPN simulator page but not for sandbox payments made using the form above (note it is also listening to PayPal's sandbox):这是我的 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.
}

Any clues as to why it doesn't pick up the IPN would be much appreciated.任何关于它为什么不接收 IPN 的线索将不胜感激。

Modified Info Log into the recipient Paypal account and setup IPN修改信息登录收款人Paypal账户并设置IPN

Steps Profile -> Profile and Settings -> My selling tools -> Instant payment notifications -> update Steps 个人资料 -> 个人资料和设置 -> 我的销售工具 -> 即时付款通知 -> 更新

Click "Choose IPN settings"点击“选择IPN设置”

Set the "Notification URL" field to what you have on "notify_url" in the HTML form.将“通知 URL”字段设置为 HTML 表单中“notify_url”上的内容。

Choose "Recieve IPN Messages"选择“接收IPN消息”

Save节省

Note: If you check IPN history, it may come up as Queued.注意:如果您检查 IPN 历史记录,它可能会显示为已排队。 This seems to be a Sandbox glitch or maybe its handling many requests and has a long queue.这似乎是一个沙盒故障,或者可能是它处理了许多请求并且排起了长队。 You can try a live payment with a small value (eg $1).您可以尝试小额付款(例如 1 美元)。 See here: Paypal IPN Status - Queued请参阅此处: Paypal IPN 状态 - 已排队

now irrelevant--- This should be a comment but I don't have the clearance to make comments.现在无关紧要---这应该是评论,但我没有发表评论的权限。 You have <button name="submit">Purchase with PayPal</button> That should be <button type="submit">Purchase with PayPal</button> Please provide the full Paypal html code within the <form></form> tags.您有<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