gpt4 book ai didi

Paypal : Invalid IPN response received even recurring payments successfully created

转载 作者:太空宇宙 更新时间:2023-11-03 16:03:24 25 4
gpt4 key购买 nike

我的 paypalipn.php 文件看起来像,

<?php

$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
$keyval = explode ('=', $keyval);
if (count($keyval) == 2)
$myPost[$keyval[0]] = urldecode($keyval[1]);
}
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
if(function_exists('get_magic_quotes_gpc')) {
$get_magic_quotes_exists = true;
}
foreach ($myPost as $key => $value) {
if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
$value = urlencode(stripslashes($value));
} else {
$value = urlencode($value);
}
$req .= "&$key=$value";
}


// STEP 2: Post IPN data back to paypal to validate

$ch = curl_init('https://www.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));


if( !($res = curl_exec($ch)) ) {
// error_log("Got " . curl_error($ch) . " when processing IPN data");
curl_close($ch);
exit;
}
curl_close($ch);


// STEP 3: Inspect IPN validation result and act accordingly

if (strcmp ($res, "VERIFIED") == 0) {


// assign posted variables 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'];
} else if (strcmp ($res, "INVALID") == 0) {

}
?>

我已经在我的应用程序中实现了 Paypal。在那里我可以成功获得定期付款的配置文件 ID,但我从即时付款通知中获得的响应无效。只有那个原因是我得到的,而且我没有收到任何更多关于此的错误消息。所以我正在寻找你的帮助来获得这个....

最佳答案

您在使用沙盒吗?实时站点不会验证沙盒中的 IPN,反之亦然。如果 IPN 来自 Sandbox,则需要将其发送回 Sandbox 进行验证。

尝试更改此代码:

$ch = curl_init('https://www.paypal.com/cgi-bin/webscr');

对此:

if($myPost['test_ipn'] == "1") {
$ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr');
} else {
$ch = curl_init('https://www.paypal.com/cgi-bin/webscr');
}

关于 Paypal : Invalid IPN response received even recurring payments successfully created,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14686791/

25 4 0