0
votes

I develop a paypal pro in magento.

my paypal code look below:

$api_username = 'sdk-three_api1.sdk.com';
$api_password = 'QFZCWN5HZM8VBG7Q';
$api_signature = 'A.d9eRKfd1yVkRrtmMfCFLTqa6M9AyodL0SJkhYztxUi8W9pCXF6.4NI';
$api_version = '57.0';
$api_endpoint = 'https://api-3t.sandbox.paypal.com/nvp';

    $request_params = array
    (
        'METHOD' => 'DoDirectPayment', 
        'USER' => $api_username, 
        'PWD' => $api_password, 
        'SIGNATURE' => $api_signature, 
        'VERSION' => $api_version, 
        'PAYMENTACTION' => 'Sale',                   
        'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
        'CREDITCARDTYPE' => $params['creditCardType'], 
        'ACCT' => $params['creditCardNumber'],                        
        'EXPDATE' => $params['expDateMonth'].$params['expDateYear'],           
        'CVV2' => $params['cvv2Number'], 
        'FIRSTNAME' => 'Tester', 
        'LASTNAME' => 'Testerson', 
        'STREET' => '707 W. Bay Drive', 
        'CITY' => 'Largo', 
        'STATE' => 'FL',                     
        'COUNTRYCODE' => 'US', 
        'ZIP' => '33770', 
        'AMT' => $plan_data['amount'], 
        'CURRENCYCODE' => 'USD', 
        'DESC' => 'Testing Payments Pro'
    );

    $nvp_string = '';
    foreach($request_params as $var=>$val)
    {
        $nvp_string .= '&'.$var.'='.urlencode($val);    
    }
    //var_dump($nvp_string); die;
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_VERBOSE, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_TIMEOUT, 30);
    curl_setopt($curl, CURLOPT_URL, $api_endpoint);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $nvp_string);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_SSLVERSION, 3);
    curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'SSLv3');
    //curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'TLSv1');

    $result = curl_exec($curl);     
    if (curl_errno($curl))
    {
        echo "CURL send a error during perform operation: ".curl_error($curl);
    } 
    else 
    {
        curl_close($curl);
    }

    // Parse the API response
    $nvp_response_array = parse_str($result);
    var_dump($result);  

But i getting an error like

error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure

And if i not added this two line

curl_setopt($curl, CURLOPT_SSLVERSION, 3);
curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'SSLv3');

then give me an error like

error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

Any help?

1
Other than removing the CURLOPT_SSLVERSION part, you will also need to make sure that your curl version supports TLS connection. Older versions of curl do not support TLS 1.0 and above. Thus, when you remove CURLOPT_SSLVERSION, the highest protocol available is SSL v3 which would fail the connection.vandershraaf
My curl version is 7.30.0. is it supported ?Dhaval Koradiya

1 Answers

0
votes

There was some updates to Sandbox recently, updates that will need to be applied on Live at a later time, this post will help you