我正在尝试从 PayPal 获取 IPN 来工作,但它不断返回INVALID
而不是VERIFIED
我看不出我做错了什么。
目前,我有 2 个使用来自 paypal 开发者网站的示例代码的 php 文件。代码似乎运行良好,我正在使用,sandbox
所以我可以看到正在转移的付款,所以我不明白为什么我会得到INVALID
.
有人可以看看代码,因为我看不到我做错了什么。
1. basic_payment.php(发送支付数据到paypal的文件)
<?php require_once ("paypalplatform.php"); $actionType = "PAY"; $cancelUrl = "http://[my server details go here]/cancel.php"; $returnUrl = "http://[my server details go here]/success.php"; $currencyCode = "GBP"; $receiverEmailArray = array( 'seller_15456764326_biz@mail.com' ); $receiverAmountArray = array( '2' ); $receiverPrimaryArray = array(); $senderEmail = ""; $feesPayer = ""; $ipnNotificationUrl = "http://[my server details go here]/ipn.php"; $memo = ""; $pin = ""; $preapprovalKey = ""; $reverseAllParallelPaymentsOnError = ""; $trackingId = generateTrackingID(); $receiverInvoiceIdArray = array( $trackingId ); $resArray = CallPay ($actionType, $cancelUrl, $returnUrl, $currencyCode, $receiverEmailArray, $receiverAmountArray, $receiverPrimaryArray, $receiverInvoiceIdArray, $feesPayer, $ipnNotificationUrl, $memo, $pin, $preapprovalKey, $reverseAllParallelPaymentsOnError, $senderEmail, $trackingId ); $ack = strtoupper($resArray["responseEnvelope.ack"]); if($ack=="SUCCESS") { if ("" == $preapprovalKey) { $cmd = "cmd=_ap-payment&paykey=" . urldecode($resArray["payKey"]); RedirectToPayPal ( $cmd ); } else { $payKey = urldecode($resArray["payKey"]); $paymentExecStatus = urldecode($resArray["paymentExecStatus"]); } } ?>
2. ipn.php(监听paypals响应的文件)
<?php $ipn_post_data = $_POST; $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; $request = curl_init(); curl_setopt_array($request, array ( CURLOPT_URL => $url, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => http_build_query(array('cmd' => '_notify-validate') + $ipn_post_data), CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HEADER => FALSE, )); $response = curl_exec($request); $status = curl_getinfo($request, CURLINFO_HTTP_CODE); curl_close($request); $to = "oshirowanen@mail.com"; $from = "me@desktop.com"; $subject = "response"; $message = "<pre>".print_r($status,true)." - ".print_r($response,true)."</pre>\n"; $header = 'To: Oshirowanen <oshirowanen@mail.com>' . "\r\n"; $header .= 'From: Me <me@desktop.com>' . "\r\n"; mail($to,$subject,$message,$header); ?>
错误消息:
Apache 错误日志 - 没有错误
这就是为什么我在 ipn.php 中添加电子邮件内容以尝试捕获某些内容,并且它正在返回:
<pre>200 - INVALID</pre>
谁能看到我做错了什么?