簡體   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