Search code examples
phppaypalexpress-checkout

Why does PayPal's Express Checkout fail with no errors?


PayPal is failing on the first step in checkout.php which is called from JavaScript. I am using the sandbox and have tried running it locally and on a server. I sent a tech. support request explaining the problem but after 3 days I have heard nothing back from them. Blame it on the weather I guess.

The following contains a string of parameters that all seem to be correctly entered. It also contains blank error messages:

nvpstr=&PAYMENTREQUEST_0_AMT=15.00&PAYMENTREQUEST_0_PAYMENTACTION=Sale&RETURNURL=http://jquery.bunkerhill.com/php/orderconfirm.php&CANCELURL=http://jquery.bunkerhill.com/php/cancel.php&PAYMENTREQUEST_0_CURRENCYCODE=USD&REQCONFIRMSHIPPING=0&NOSHIPPING=1&L_PAYMENTREQUEST_0_NAME0=jQuery-Translator&L_PAYMENTREQUEST_0_AMT0=15.00&L_PAYMENTREQUEST_0_QTY0=1&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital

ACK=SetExpressCheckout API call failed.

Detailed Error Message:

Short Error Message:

Error Code:

Error Severity Code:

Has anyone experienced similar problems?

checkout.php:

<?php
require_once ("paypalfunctions.php");

$PaymentOption = "PayPal";
if ($PaymentOption == "PayPal")
{
    // ==================================
    // PayPal Express Checkout Module
    // ==================================    

    //'------------------------------------
    //' The paymentAmount is the total value of 
    //' the purchase.
    //'
    //' TODO: Enter the total Payment Amount within the quotes.
    //' example : $paymentAmount = "15.00";
    //'------------------------------------

    $paymentAmount = "15.00";

    //'------------------------------------
    //' The currencyCodeType  
    //' is set to the selections made on the Integration Assistant 
    //'------------------------------------
    $currencyCodeType = "USD";
    $paymentType = "Sale";

    //'------------------------------------
    //' The returnURL is the location where buyers return to when a
    //' payment has been succesfully authorized.
    //'
    //' This is set to the value entered on the Integration Assistant 
    //'------------------------------------
    $returnURL = "http://jquery.bunkerhill.com/php/orderconfirm.php";

    //'------------------------------------
    //' The cancelURL is the location buyers are sent to when they hit the
    //' cancel button during authorization of payment during the PayPal flow
    //'
    //' This is set to the value entered on the Integration Assistant 
    //'------------------------------------
    $cancelURL = "http://jquery.bunkerhill.com/php/cancel.php";

    //'------------------------------------
    //' Calls the SetExpressCheckout API call
    //'
    //' The CallSetExpressCheckout function is defined in the file PayPalFunctions.php,
    //' it is included at the top of this file.
    //'-------------------------------------------------

    $items = array();
    $items[] = array('name' => 'jQuery-Translator', 'amt' => $paymentAmount, 'qty' => 1);

    //::ITEMS::

    // to add anothe item, uncomment the lines below and comment the line above 
    // $items[] = array('name' => 'Item Name1', 'amt' => $itemAmount1, 'qty' => 1);
    // $items[] = array('name' => 'Item Name2', 'amt' => $itemAmount2, 'qty' => 1);
    // $paymentAmount = $itemAmount1 + $itemAmount2;

    // assign corresponding item amounts to "$itemAmount1" and "$itemAmount2"
    // NOTE : sum of all the item amounts should be equal to payment  amount 

    $resArray = SetExpressCheckoutDG( $paymentAmount, $currencyCodeType, $paymentType, 
                                            $returnURL, $cancelURL, $items );
    $ack = strtoupper($resArray["ACK"]);
    if($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING")
    {
            $token = urldecode($resArray["TOKEN"]);
            RedirectToPayPalDG( $token );
    } 
    else  
    {
            //Display a user friendly Error on the page using any of the following error information returned by PayPal
            $ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
            $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
            $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
            $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);

            echo "SetExpressCheckout API call failed. " . "<br/>";
            echo "Detailed Error Message: " . $ErrorLongMsg . "<br/>";
            echo "Short Error Message: " . $ErrorShortMsg . "<br/>";
            echo "Error Code: " . $ErrorCode . "<br/>";
            echo "Error Severity Code: " . $ErrorSeverityCode . "<br/>";
    }
}

?>

Solution

  • You must be getting a blank response back from PayPal, which means you're probably getting a curl error, which means you're probably running into the SSLv3 handshake failure that PayPal just flipped the switch with on 1/19/16.

    This is something PayPal did because of the POODLE vulnerability.

    What you should do is check for curl error to verify this is the problem you're running into (I can almost guarantee it because we're seeing a whole lot of it since they flipped the switch.)

    Then, the easiest thing to do is contact your web host and explain that you're running into this problem and they need to update your server to fix it. It basically comes down to the server stack of software, specifically OpenSSL, getting updated to supported versions that handle TLS fallback correctly.