Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php PayPal ipnNotificationUrl已关闭,并且未向URL发送通知_Php_Paypal_Paypal Adaptive Payments - Fatal编程技术网

Php PayPal ipnNotificationUrl已关闭,并且未向URL发送通知

Php PayPal ipnNotificationUrl已关闭,并且未向URL发送通知,php,paypal,paypal-adaptive-payments,Php,Paypal,Paypal Adaptive Payments,我正在使用paypal自适应支付API,直到上个月一切都正常 问题是ipnNotificationUrl没有向我在代码中提供的URL发送任何通知 这是PayPal自适应支付的代码 <?php class Paypal{ private $api_user; private $api_pass; private $api_sig; private $app_id; private $apiUrl = 'https://svcs.sand

我正在使用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;



    }

}
这是非常好的,我可以使用paykey,但ipnNotificationUrl不能正常工作。它在URL上根本不发送任何内容

我不想解决这个问题

1) 是否更改了ipnNotificationUrl的URL,甚至进行了硬编码

2) 使用IPN模拟器(侦听器)进行测试,用于测试

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


请帮忙

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

这里有更多细节


希望这个答案能对其他人有所帮助。

您是否尝试登录您的PayPal帐户并查看所有尝试IPN通知的结果?PayPal有没有尝试发送任何东西到你的URL?没有,我没有,现在要检查一下,谢谢你的建议!是的,它确实尝试将IPN发送到URL并将状态显示为排队
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" }