[英]PHP IPN script works with IPN simulator but not with PayPal button
我設置了 PayPal 沙箱帳戶並創建了一個按鈕並將其放入 HTML。 當我使用 IPN 模擬器測試所有內容時,它工作得很好,但是當通過 PayPal 按鈕(沙盒模式)進行購買時,沒有任何反應。 這是按鈕代碼
<form action="https://sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="NC4M3RU83QEDG">
<input type="image" src="https://www.sandbox.paypal.com/en_US/GB/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
這是 ipn 腳本(適用於 ipn 模擬器)
$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") {
$to = 'something@hotmail.com';
$subject = 'Something';
$headers = 'From:noreply@something.com' . "\r\n";
$message = 'bla bla bla';
mail($to, $subject, $message, $headers);
}
我已經在我的賬戶中啟用了 IPN,並且我已經正確設置了通知 url 問候
詳細說明“什么都沒有發生”。 檢查您的沙盒帳戶的 IPN 歷史記錄: https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_display-ipns-history
將日志記錄添加到您的 IPN 腳本。 它是否接收來自 PayPal 的消息? 記錄收到的每條消息。 是否能夠嘗試驗證它們? 嘗試驗證它們時的響應是什么?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.