PPPttpConnection.php中的Paypal Adaptive Payments PPConnectionException

时间:2016-05-02 13:48:57

标签: php laravel paypal paypal-adaptive-payments

我目前尝试使用自适应支付sdk实施链式支付。我收到此错误

PPConnectionException in PPHttpConnection.php line 91:
error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure

我的示例代码如下所示

$payRequest = new \PayPal\Types\AP\PayRequest();

    $receiver = array();
    $receiver[0] = new \PayPal\Types\AP\Receiver();
    $receiver[0]->amount = '7.50';
    $receiver[0]->email = "admin@example.de";

    $receiver[1] = new \PayPal\Types\AP\Receiver();
    $receiver[1]->amount = '2.50';
    $receiver[1]->email = "seller@example.de";
    $receiver[1]->primary = "true";
    $receiverList = new \PayPal\Types\AP\ReceiverList($receiver);
    $payRequest->receiverList = $receiverList;

    $requestEnvelope = new \PayPal\Types\Common\RequestEnvelope("de_DE");
    $payRequest->requestEnvelope = $requestEnvelope;
    $payRequest->actionType = "PAY";
    $payRequest->cancelUrl = "http://example.de:8080/payment/cancel";
    $payRequest->returnUrl = "http://example.de:8080?returned";
    $payRequest->currencyCode = "EUR";
    $payRequest->ipnNotificationUrl = "http://example.de:8080";

    $sdkConfig = array(
        'mode' => 'sandbox',
        "acct1.UserName" => "jb-us-seller_api1.paypal.com",
        "acct1.Password" => "WX4WTU3S8MY44S7F",
        "acct1.Signature" => "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy",
        "acct1.AppId" => "APP-80W284485P519543T"
    );

    $adaptivePaymentsService = new \PayPal\Service\AdaptivePaymentsService($sdkConfig);
    $payResponse = $adaptivePaymentsService->Pay($payRequest);

    if ($payResponse->responseEnvelope->ack == "Success")
    {
        redirect('Location: ' . 'https://sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=' . $payResponse->payKey);
    }
    else{
        die('error');
    }

我发现的解决方案似乎不起作用......任何想法?目前正在从localhost进行测试。

1 个答案:

答案 0 :(得分:0)

我不知道错误的实际解决方案或原因。

为我修复的是在实际服务器而不是我的localhost环境中测试它。

我还将软件包更新到最新版本,因为有很多关于tls的更改。较旧的示例不引用工作库。