PayPal自适应支付"Pay"请求中抛出"PPConnectionException"异常 [英] 'PPConnectionException' exception is thrown in PayPal adaptive Payment 'Pay' request

查看:283
本文介绍了PayPal自适应支付"Pay"请求中抛出"PPConnectionException"异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的WordPress插件之一中集成了PayPal自适应支付.我的功能已经完全准备就绪,并且可以很好地工作到昨天.但是,当我开始进行最终测试时,我陷入了这种异常-

I have integrated PayPal adaptive payments in my one of the WordPress plugin. My functionality is fully ready and was working well till yesterday. However, when I started with a final testing, I got stuck with this exception -

PPConnectionException Object ( [url:PPConnectionException:private] => https://svcs.sandbox.paypal.com/AdaptivePayments/Pay [data:PPConnectionException:private] => [message:protected] => error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number 
........) //I am just pasting necessary piece of error to understand the problem

我使用了这个库- https://github.com/paypal/adaptivepayments-sdk- php

我正在沙盒环境下对其进行测试.

I am testing it under sandbox environment.

问题似乎与OpenSSL或cURL有关.

The problem seems to have with OpenSSL or cURL.

我搜索了很多解决方案,但没有找到任何有用的答案.

I searched for the solution a lot but did not find any helpful answer.

我还在下面粘贴了一个示例代码(这是针对并行"付款方式,但此方式或其他方式均无效)-

I am also pasting a sample code below (this is for 'parallel' payment method, but neither this nor other methods work) -

require_once('../PPBootStrap.php');
require_once('../Common/Constants.php');
define("DEFAULT_SELECT", "- Select -");

if(isset($_POST['receiverEmail'])) {
    $receiver = array();
    /*
     * A receiver's email address 
     */
    for($i=0; $i<count($_POST['receiverEmail']); $i++) {
        $receiver[$i] = new Receiver();
        $receiver[$i]->email = $_POST['receiverEmail'][$i];
        /*
         *      Amount to be credited to the receiver's account 
         */
        $receiver[$i]->amount = $_POST['receiverAmount'][$i];
        /*
         * Set to true to indicate a chained payment; only one receiver can be a primary receiver. Omit this field, or set it to false for simple and parallel payments. 
         */
        $receiver[$i]->primary = $_POST['primaryReceiver'][$i];

    }
    $receiverList = new ReceiverList($receiver);
}

$payRequest = new PayRequest(new RequestEnvelope("en_US"), $_POST['actionType'], $_POST['cancelUrl'], $_POST['currencyCode'], $receiverList, $_POST['returnUrl']);
// Add optional params

if($_POST["memo"] != "") {
    $payRequest->memo = $_POST["memo"];
}

$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->Pay($payRequest);
} catch(Exception $ex) {
    require_once '../Common/Error.php';
     /*******
    ***************************************************
    PLEASE NOTE: the code is breaking here, an exception is thrown
    ***************************************************
    *******/ 
    exit;
}

$_POST数据是从另一个文件传递的.

$_POST data are passed from another file.

我已将上述代码集成到我的插件中(以WordPress方式).实际上,如果我直接在单独的PHP文件中运行上述功能,那么即使这样也无法正常工作.因此,很明显,问题出在其他方面.问题似乎与PayPal和我的服务器的连接有关. 我没有得到,直到昨天所有的东西都在工作,但是突然停止了工作.另外,我的服务器上没有任何与openssl,cURL或PHP相关的更新.

I have integrated the above code in my plugin (in WordPress way). In fact, if I run above functionality directly in a separate PHP file, even that does not work. So, its clear that the problem is something else. The problem seem to have with connection with PayPal and my server. I am not getting, all the things were working till yesterday, but suddenly has stopped working. Also, nothing has been updated related to openssl, cURL or PHP on my server.

任何帮助将不胜感激.谢谢 !!!

Any help would be greatly appreciated. Thanks !!!

更改openssl版本号可以解决此问题.但是,我仍然担心版本号14中的哪个是正确的并且将来会工作. 另外,将值从3更改为其他内容时是否存在任何安全问题? 如果有人可以澄清这一点,那就太好了.再次感谢.

Changing the openssl version number solves the issue. However, I am still concerned which among version number 1 and 4 is proper and will work in future. Also, is there any security issue concerned when changing the value from 3 to something else? If anyone could clarify this, it would be great. Thanks again.

推荐答案

我遇到了同样的问题.似乎PayPal昨天已针对安全问题进行了一些更改.下载刚刚发布的PayPal PHP SDK新版本应该可以解决该问题

I had the same problem. Seems as though PayPal made some changes yesterday in response to a security issue. Downloading the new version of PayPal PHP SDK that was just released should fix it

https://github.com/paypal/rest-api-sdk-php/releases/tag/v0.13.1

这篇关于PayPal自适应支付"Pay"请求中抛出"PPConnectionException"异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆