我已经通过贝宝自适应支付进行了支付,并且成功了
然后我发送验证请求,我得到了 status=VERIFIED
这是代码:
function process_new() {
$req = 'cmd=_notify-validate&'.file_get_contents("php://input");
$ipnmsg=$this->decodePayPalIPN($req);
$ch = curl_init('https://www.sandbox.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'));
$res=curl_exec($ch);
curl_close($ch);
//if ($this->InstantPaymentNotification->is_valid($req))
if($res=='VERIFIED') // i got verified here
{
$txnIds=array();
$notifications = $this->InstantPaymentNotification->buildAssociationsFromIPN_new($ipnmsg);
foreach($notifications as $notification){
$this->IpnNotification->create();
$this->IpnNotification->save($notification);
$txnIds[]=$this->IpnNotification->id;
}
//$this->InstantPaymentNotificationNew->saveAll($notification);
$this->__processTransactionNew($txnIds);
}
//$this->redirect('/');
}
无法找到 notify_url 不断命中的原因。
如果需要更多信息,我也会发布它们......
这是 IPN 历史:
`$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);`
它返回 200 但贝宝仍然显示 HTTP 状态代码:500
并且通知网址:http ://example.com/instant_payment_notifications/process_new 不返回 HTTP 状态代码:500
谢谢。