0

我正在使用以下代码进行 PayPal 链式付款

require_once ("paypalplatform.php");
$amount=100;
$amt1=($amount * 10 )/100;
$amt2=$amount-$amt1;

$actionType         = "PAY";
$cancelUrl          = "http://test.com/test";

$returnUrl          = "http://test.com/test";
$currencyCode               = "USD";

$receiverEmailArray = array(
        'a***********_per@gmail.com',
        'a***********_biz@gmail.com'
        );

$receiverAmountArray = array(
        $amt1,
        $amt2
        );

$receiverPrimaryArray = array();

$receiverInvoiceIdArray = array(
        '1',
        '2'
        );

$senderEmail                    = "a************_per@gmail.com";        
$feesPayer                  = "";
$ipnNotificationUrl             = "http://test.com/paypal/buynow.php";
$memo                       = "";       
$pin                        = "agalameex";      
$preapprovalKey                 = "";       
$reverseAllParallelPaymentsOnError          = "";   
$trackingId                 = generateTrackingID();
$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)
    {
        // redirect for web approval flow
        $cmd = "cmd=_ap-payment&paykey=" . urldecode($resArray["payKey"]);
        RedirectToPayPal ( $cmd );
    }
    else
    {
        // payKey is the key that you can use to identify the result from this Pay call
        $payKey = urldecode($resArray["payKey"]);
        // paymentExecStatus is the status of the payment
        $paymentExecStatus = urldecode($resArray["paymentExecStatus"]);
    }
} 
else  
{
    //Display a user friendly Error on the page using any of the following error information returned by PayPal
    //TODO - There can be more than 1 error, so check for "error(1).errorId", then "error(2).errorId", and so on until you find no more errors.
    $ErrorCode = urldecode($resArray["error(0).errorId"]);
    $ErrorMsg = urldecode($resArray["error(0).message"]);
    $ErrorDomain = urldecode($resArray["error(0).domain"]);
    $ErrorSeverity = urldecode($resArray["error(0).severity"]);
    $ErrorCategory = urldecode($resArray["error(0).category"]);

echo "Preapproval API call failed. ";
echo "Detailed Error Message: " . $ErrorMsg;
echo "Error Code: " . $ErrorCode;
echo "Error Severity: " . $ErrorSeverity;
echo "Error Domain: " . $ErrorDomain;
echo "Error Category: " . $ErrorCategory;

}

在上面的代码中,除了返回通知 ($ipnNotificationUrl) 之外,一切都运行良好。付款完成后,我没有收到来自 $ipnNotificationUrl 的任何通知。任何机构都可以帮助我吗?

4

2 回答 2

1

检查您在 PayPal 中的 IPN 历史记录。如果它显示除了 200 响应代码之外的任何内容,您就知道您的 IPN 侦听器有问题。

您可以检查您的 Web 服务器日志,以确切了解在命中脚本时发生的错误。

或者,您可以设置一个简单的 HTML 表单,其中包含与您期望从 PayPal 获得的内容相匹配的隐藏字段。然后你可以在浏览器中提交它,这样你就可以在屏幕上看到结果。

请记住,以这种方式进行测试会导致来自 PayPal 的响应无效,因为 IPN 数据并非来自他们的服务器,但您可以针对测试目的进行相应调整,修复您的问题,然后您会很好去。

于 2013-01-10T00:28:51.627 回答
-1

调试提示:在 PayPal 后端检查您的 IPN 配置。用一个简单的脚本替换您的脚本,该脚本只显示调用它的时间和输入。

于 2013-01-09T14:50:40.193 回答