documentation에서 직접 IPN 예제를 사용하고 있습니다.IPN 게시물이 매번 비어 있음
PayPal은 문제없이 지불하지만 PayPal은 아무런 문제없이 내 리스너로 리디렉션되지만 항상 빈 $ _POST 변수가 있습니다. 누구든지 문제를 볼 수 있습니까?
<?php
// Send an empty HTTP 200 OK response to acknowledge receipt of the notification
header('HTTP/1.1 200 OK');
// Assign payment notification values to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
// Build the required acknowledgement message out of the notification just received
$req = 'cmd=_notify-validate'; // Add 'cmd=_notify-validate' to beginning of the acknowledgement
echo '<pre>';
var_dump($_POST);
echo '</pre><hr/>';
foreach ($_POST as $key => $value) { // Loop through the notification NV pairs
$value = urlencode(stripslashes($value)); // Encode these values
$req .= "&$key=$value"; // Add the NV pairs to the acknowledgement
}
// Set up the acknowledgement request headers
$header = "POST /cgi-bin/webscr HTTP/1.1\r\n"; // HTTP POST request
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
// Open a socket for the acknowledgement request
$fp = fsockopen('ssl://www.paypal.com', 443, $errno, $errstr, 30);
// Send the HTTP POST request back to PayPal for validation
fputs($fp, $header . $req);
while (!feof($fp)) { // While not EOF
$res = fgets($fp, 1024); // Get the acknowledgement response
if (strcmp ($res, "VERIFIED") == 0) { // Response contains VERIFIED - process notification
// Authentication protocol is complete - OK to process notification contents
echo 'thanks for the payment, we are processing your request.';
} else if (strcmp ($res, "INVALID") == 0) {
//Response contains INVALID - reject notification
echo 'something has gone wrong. please try again.';
}
}
fclose($fp); // Close the file
?>
결과 : 버튼 코드를 추가로 업데이트
array(0) {
}
something has gone wrong. please try again.
:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="business" value="H7G2W8WN4XXXXX">
<input type="hidden" name="item_name_1" value="Item Name">
<input type="hidden" name="amount_1" value="0.25">
<input type="hidden" name="item_name_2" value="Item Name 2">
<input type="hidden" name="amount_2" value="0.25">
<input type="submit" value="Buy Now"/>
</form>
당신이 여기에 버튼 코드를 게시 할 수 : 여기
이를 찾는 사람을위한 링크입니다? – Eshan@Eshan이 포함되었습니다. –
[IPN Simulator] (https://developer.paypal.com/webapps/developer/applications/ipn_simulator)를 사용하여 테스트 요청을 보내 봤습니까? 방금 단순한 2 줄 스크립트 (헤더를 반환하고 $ _POST를 파일에 덤프)를 사용하여이 작업을 직접 수행했으며 예상대로 작동했습니다. – timclutton