PayPal ipnNotificationUrl关闭,不向URL发送通知


PayPal ipnNotificationUrl Turned off and not sending notifications to URL

我正在使用paypal自适应支付API,直到上个月一切都很好。

问题是ipnNotificationUrl没有向代码中提供的URL发送任何通知。

这是PayPal自适应支付的代码,

<?php
class Paypal{

    private $api_user;
    private $api_pass;
    private $api_sig;
    private $app_id;
    private $apiUrl = 'https://svcs.sandbox.paypal.com/AdaptivePayments/';
    private $paypalUrl="https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=";
    private $headers;

    public function setDetails($api_u, $api_p, $api_s, $api_id){

        $this->api_user = $api_u;
        $this->api_pass = $api_p;
        $this->api_sig = $api_s;
        $this->app_id = $api_id;

        $this->headers = array(
            "X-PAYPAL-SECURITY-USERID: ".$this->api_user,
            "X-PAYPAL-SECURITY-PASSWORD: ".$this->api_pass,
            "X-PAYPAL-SECURITY-SIGNATURE: ".$this->api_sig,
            "X-PAYPAL-REQUEST-DATA-FORMAT: JSON",
            "X-PAYPAL-RESPONSE-DATA-FORMAT: JSON",
            "X-PAYPAL-APPLICATION-ID: ".$this->app_id,
        );

    }

    public function getPaymentOptions($paykey){
        $pack = array(
            "requestEnvelope" => array(
                "errorLanguage" => "en_US",
                "detailLevel" => "ReturnAll",
            ),
            "payKey" => $paykey
        );
        return $this->_paypalSend($pack, "GetPaymentOptions");
    }

    public function setPaymentOptions(){

    }

    public function _paypalSend($data,$call){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->apiUrl.$call);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
        $response = json_decode(curl_exec($ch),true);
        return $response;

    }
    public function splitPay($currency, $r1_email, $r2_email, $r1_amount, $r2_amount, $returnUrl, $cancelUrl, $product_name, $indentifier){

        $createPacket = array(
            "actionType" =>"PAY",
            "currencyCode" => $currency,
            "receiverList" => array("receiver" => 
                array(
                    array(
                        "amount"=> $r1_amount,
                        "email"=> $r1_email
                    ),
                    array(
                        "amount"=> $r2_amount,
                        "email"=> $r2_email
                    )
            )
            ),
            "returnUrl" => $returnUrl,
            "cancelUrl" => $cancelUrl,
            "ipnNotificationUrl" => URL::to('/adaptive_payments'),
            "requestEnvelope" => array(
                "errorLanguage" => "en_US",
                "detailLevel" => "ReturnAll",
            ),
        );

        $response = $this->_paypalSend($createPacket,"Pay");

        $paykey = $response['payKey'];

        $detailsPack = array(
            "requestEnvelope" => array(
                "errorLanguage" => "en_US",
                "detailLevel" => "ReturnAll",
            ),
            "payKey" => $paykey,
            "receiverOptions" => array(
                array(
                    "receiver" => array("email" => $r1_email),
                    "invoiceData" => array(
                        "item" => array(
                            array(
                                array(
                                    "name" => $product_name,
                                    "price" => $r1_amount,
                                    "identifier" => $indentifier
                                )
                            )
                        )
                    )
                ),
                array(
                    "receiver" => array("email" => $r2_email),
                    "invoiceData" => array(
                        "item" => array(
                            array(
                                array(
                                    "name" => "product 2",
                                    "price" => $r2_amount,
                                    "identifier" => "p2"
                                )
                            )
                        )
                    )
                )
            )
        );

        $response = $this->_paypalSend($detailsPack, "SetPaymentOptions");

        $dets = $this->getPaymentOptions($paykey);

        return $this->paypalUrl.$paykey;

    }
}

这里我得到的响应是

array(3) { ["responseEnvelope"]=> array(4) { ["timestamp"]=> string(29) "2015-06-04T14:04:07.395-07:00" ["ack"]=> string(7) "Success" ["correlationId"]=> string(13) "6c472863c4053" ["build"]=> string(8) "15743565" } ["payKey"]=> string(20) "AP-5LN44020A0587750B" ["paymentExecStatus"]=> string(7) "CREATED" } 

这是非常好的,我可以使用paykey,但ipnNotificationUrl不工作,因为它应该。它不会在URL上发送任何东西。

我试图解决这个问题,

1)没有改变ipnNotificationUrl的URL,甚至做了硬编码

2)用IPN模拟器(监听器)测试,为测试工作

3)更改返回URL并取消URL以测试是否其他工作,也确保我正在使用正确的文件和代码

请帮忙!

代码运行正常,这并不是因为paypal将IPN放入队列。

更多细节请点击https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNOperations/