Forum

Thread tagged as: Problem, Shop

Checkout issue

I'm struggling with getting PayPal to checkout. On my local server, I'm seeing a Fatal error:

Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 35: Unsupported SSL protocol version [url] https://api-3t.paypal.com/nvp' in /PATH_TO/local/perch/addons/apps/perch_shop/lib/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php:359 Stack trace: #0 /PATH_TO/local/perch/addons/apps/perch_shop/lib/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(292): Guzzle\Http\Curl\CurlMulti->isCurlException(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array) #1 /PATH_TO/local/perch/addons/apps/perch_shop/lib/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(257): Guzzle\Http\Curl\CurlMulti->processResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array) #2 /PATH_TO/local/perch/addons/apps/perch_shop/lib/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(240 in /PATH_TO/local/perch/addons/apps/perch_shop/lib/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php on line 359

I'm guessing there's something about the local setup that means this won't work.

When I try to checkout on the dev server, I'm redirected to the cancellation URL each time. I've tried with two different sets of test API credentials, as well as some live credentials (changing test_mode to false), and each time I'm redirected back to my cancellation URL. Manual checkout seems to direct me to my success URL at least.

Here's my diagnostic:

Perch: 2.8.29, PHP: 5.6.17-0+deb8u1, MySQL: 5.5.46, with PDO
Server OS: Linux, apache2handler
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_blog (5.0), perch_events (1.9.2), perch_forms (1.8.3), perch_shop_orders (1.0), perch_shop_products (1.0), perch_shop (1.0.1), perch_members (1.5), perch_twitter (3.5.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_members', 'perch_shop', 'perch_events', 'perch_twitter', );
PERCH_LOGINPATH: /perch
PERCH_PATH: PATH_TO/web/content/perch
PERCH_CORE: PATH_TO/web/content/perch/core
PERCH_RESFILEPATH: PATH_TO/web/content/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 8M, Max POST 8M, Memory: 128M, Total max file upload: 8M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: dev.DOMAIN.org.uk
DOCUMENT_ROOT: PATH_TO/web/content
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Paul Bell

Paul Bell 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us your checkout code and the debug from the checkout page?

Sure thing.

Here's the checkout page:

<?php if (!defined('PERCH_RUNWAY')) include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php'); ?>
<?php
// We only try to do a checkout if there's a Post value - either from our Checkout button on the cart page, or from our registration page.
if (perch_member_logged_in()) {
    if(perch_post('check_me_out') == 'y' || perch_post('cms-form'))
    {
        // your 'success' return URL
        $return_url = "https://".$_SERVER['HTTP_HOST'].'/confirm/';
        $cancel_url = "https://".$_SERVER['HTTP_HOST'].'/cancel/';

        perch_shop_checkout('paypal_express', [
            'return_url' => $return_url,
            'cancel_url' => $cancel_url,
        ]);
    }
    else
    {
        header('Location: /cart/');
        exit;
    }
}
    PerchSystem::set_vars(array(
        'title'=>'Checkout',
        'keywords'=>'',
        'desc'=>''
    ));
?>
<?php perch_layout('global.head'); ?>
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <?php
                if (!perch_member_logged_in()) {
                    perch_shop_registration_form([
                        'template' => 'checkout/customer_create_passwordless.html'
                    ]);
                }
            ?>
        </div>
    </div>
</div>
<?php perch_layout('global.foot'); ?>

I only want to do a checkout if there's a value in the $_POST array (to avoid multiple checkouts on a page refresh), otherwise I'm redirecting to the checkout page.

I don't know how I can show you DEBUG info from the checkout page - it either throws a fatal error on my local setup, or redirects straight on to the cancellation page on my dev server.

Here's my shop.php config file (minus the credentials). Anything awry here?

<?php
  return [
    'gateways' => [
      'paypal-express' => [
        'enabled'   => true,
        'test_mode' => true,
        'live' => [
          'username'  => 'XXXXXXXXX',
          'password'  => 'XXXXXXXXXXXXXX',
          'signature' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
        ],
        'test' => [
          'username'  => 'XXXXXXXXXX',
          'password'  => 'XXXXXXXXXXXXXXX',
          'signature' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
        ],
      ],
    ],
  ];
?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Before you call perch_shop_checkout(), add this:

PerchUtil::hold_redirects();

That will stop the redirect occurring and should enable you to see the debug.

Thanks, Drew - yes, that's worked. Here's the debug:

Debug Message
[1] SELECT * FROM perch2_pages WHERE pagePath='/checkout/index.php' LIMIT 1
[1] SELECT * FROM perch2_shop_cart WHERE cartID=18
[1] SELECT * FROM perch2_shop_cart WHERE cartID=18
[34] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[0] SELECT COUNT(*) FROM perch2_members WHERE memberPassword IS NOT NULL AND memberEmail='info@domain.com'
[0] SELECT COUNT(*) FROM perch2_members WHERE memberPassword IS NOT NULL AND memberEmail='info@domain.com'
[1] SELECT * FROM perch2_members_forms WHERE formKey='register' LIMIT 1
INSERT INTO perch2_members(memberAuthType,memberEmail,memberPassword,memberStatus,memberCreated,memberProperties) VALUES('native','info@domain.com','$P$BC7XkAkNJdsFDKFsaQP4anJwx1ygbx1','pending','2016-05-19 13:43:22','{\"first_name\":\"Test\",\"last_name\":\"Test\"}')
[1] SELECT * FROM perch2_members WHERE memberID='7' LIMIT 1
No ids to log.
UPDATE perch2_members SET memberAuthID='7', memberStatus='active' WHERE memberID='7'
No ids to log.
[1] SELECT * FROM perch2_members WHERE memberAuthType='native' AND memberPassword IS NOT NULL AND memberEmail='info@domain.com' AND memberStatus='active' AND (memberExpires IS NULL OR memberExpires>'2016-05-19 13:43:22') LIMIT 1
Password is ok.
[1] SELECT * FROM perch2_members WHERE memberAuthType='native' AND memberAuthID='7' LIMIT 1
log them in
[0] SELECT t.tag FROM perch2_members_tags t, perch2_members_member_tags mt WHERE t.tagID=mt.tagID AND mt.memberID='7' AND (mt.tagExpires IS NULL OR mt.tagExpires>'2016-05-19 13:43:00')
INSERT INTO perch2_members_sessions(sessionID,sessionExpires,sessionHttpFootprint,memberID,sessionData) VALUES('751c86eb63fc87add806b43cef43c2bcaafbd44f','2016-05-24 13:43:22','e4d7b68a20c4ce36424057e12ce3ae2f85853c89','7','{\"first_name\":\"Test\",\"last_name\":\"Test\",\"memberID\":\"7\",\"memberAuthType\":\"native\",\"memberAuthID\":\"7\",\"memberEmail\":\"info@domain.com\",\"memberStatus\":\"active\",\"memberCreated\":\"2016-05-19 13:43:22\",\"memberExpires\":null,\"tags\":[],\"token\":\"9f198c0ab96df8a04fc4b81a942cda79616b5e82\"}')
DELETE FROM perch2_members_sessions WHERE sessionExpires < '2016-05-19 13:43:22'
[1] SELECT * FROM perch2_members_sessions WHERE sessionID='751c86eb63fc87add806b43cef43c2bcaafbd44f' AND sessionHttpFootprint='e4d7b68a20c4ce36424057e12ce3ae2f85853c89' AND sessionExpires>'2016-05-19 13:43:22' LIMIT 1
User is logged in
UPDATE perch2_shop_cart SET memberID='7' WHERE cartID='18'
[1] SELECT * FROM perch2_shop_customers WHERE memberID=7
Template file not found: /PATH_TO_WEB_ROOT/web/content/perchlogin/login_form.html
------------------------------ here mem ------------------------------
UPDATE perch2_members SET memberPassword=NULL WHERE memberID='7'
No ids to log.
INSERT INTO perch2_shop_customers(customerDynamicFields,memberID,customerCreated) VALUES('{\"first_name\":\"Test\",\"last_name\":\"Test\",\"email\":\"info@domain.com\"}','7','2016-05-19 13:43:22')
[1] SELECT * FROM perch2_shop_customers WHERE customerID='7' LIMIT 1
No ids to log.
UPDATE perch2_shop_customers SET customerDynamicFields='{\"first_name\":\"Test\",\"last_name\":\"Test\",\"email\":\"info@domain.com\"}', memberID='7', customerCreated='2016-05-19 13:43:22', customerFirstName='Test', customerLastName='Test', customerEmail='info@domain.com', customerUpdated='2016-05-19 13:43:22' WHERE customerID='7'
No ids to log.
INSERT INTO perch2_shop_addresses(addressDynamicFields,addressTitle,addressCreated) VALUES('{\"first_name\":\"Test\",\"last_name\":\"Test\",\"address_1\":\"Address\",\"address_2\":\"Address\",\"postcode\":\"AB1 2CD\",\"country\":\"236\",\"company\":\"Boiler Room Digital\",\"city\":\"City\",\"county\":\"County\",\"customer\":\"7\"}','default','2016-05-19 13:43:22')
[1] SELECT * FROM perch2_shop_addresses WHERE addressID='114' LIMIT 1
No ids to log.
UPDATE perch2_shop_addresses SET addressDynamicFields='{\"first_name\":\"Test\",\"last_name\":\"Test\",\"address_1\":\"Address\",\"address_2\":\"Address\",\"postcode\":\"AB1 2CD\",\"country\":\"236\",\"company\":\"Boiler Room Digital\",\"city\":\"City\",\"county\":\"County\",\"customer\":\"7\"}', addressTitle='default', addressCreated='2016-05-19 13:43:22', addressFirstName='Test', addressLastName='Test', addressCompany='Boiler Room Digital', addressLine1='Address', customerID='7', countryID='236', addressUpdated='2016-05-19 13:43:22' WHERE addressID='114'
No ids to log.
UPDATE perch2_shop_cart SET billingAddress='default', shippingAddress='default' WHERE cartID='18'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch2_shop_cart WHERE cartID=18
[1] SELECT * FROM perch2_shop_cart WHERE cartID=18
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
[1] SELECT locationID FROM perch2_shop_tax_locations WHERE locationIsHome=1 LIMIT 1
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_customers WHERE memberID=7
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=47 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch2_shop_cart_items WHERE cartID=18
Tax mode: inc
[2] SELECT * FROM perch2_shop_cart_items WHERE cartID=18 ORDER BY itemID ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=2 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[0] SELECT r.rateValue FROM perch2_shop_tax_group_rates gr, perch2_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[1] SELECT * FROM perch2_shop_products WHERE productID=34 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[0] SELECT r.rateValue FROM perch2_shop_tax_group_rates gr, perch2_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[nil] SELECT * FROM perch2_shop_promotions WHERE promoFrom<='2016-05-19 13:43:00' AND promoTo>'2016-05-19 13:43:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
UPDATE perch2_shop_cart SET cartTotalItems='80', cartTotalProducts='2', cartTotalWithTax='18.15', cartTotalWithoutTax='18.15' WHERE cartID='18'
[1] SELECT * FROM perch2_shop_customers WHERE memberID=7
[1] SELECT * FROM perch2_shop_addresses WHERE customerID='7' AND orderID IS NULL AND addressSlug='default'
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationDeleted IS NULL AND ((countryID=236 AND regionID IS NULL) OR locationIsDefault=1) ORDER BY locationIsDefault ASC LIMIT 1
UPDATE perch2_shop_cart SET locationID='1' WHERE cartID='18'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch2_shop_cart WHERE cartID=18
[1] SELECT * FROM perch2_shop_cart WHERE cartID=18
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
[1] SELECT locationID FROM perch2_shop_tax_locations WHERE locationIsHome=1 LIMIT 1
[1] SELECT * FROM perch2_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_customers WHERE memberID=7
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=47 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch2_shop_cart_items WHERE cartID=18
Tax mode: inc
[2] SELECT * FROM perch2_shop_cart_items WHERE cartID=18 ORDER BY itemID ASC
[1] SELECT * FROM perch2_shop_products WHERE productID=2 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[0] SELECT r.rateValue FROM perch2_shop_tax_group_rates gr, perch2_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[1] SELECT * FROM perch2_shop_products WHERE productID=34 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[0] SELECT r.rateValue FROM perch2_shop_tax_group_rates gr, perch2_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[nil] SELECT * FROM perch2_shop_promotions WHERE promoFrom<='2016-05-19 13:43:00' AND promoTo>'2016-05-19 13:43:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
UPDATE perch2_shop_cart SET cartTotalItems='80', cartTotalProducts='2', cartTotalWithTax='18.15', cartTotalWithoutTax='18.15' WHERE cartID='18'
Holding redirects
Checking out with paypal_express
Member ID: 7
[1] SELECT * FROM perch2_shop_customers WHERE memberID=7
[1] SELECT * FROM perch2_shop_addresses WHERE customerID='7' AND orderID IS NULL AND addressSlug='default'
[1] SELECT * FROM perch2_shop_addresses WHERE customerID='7' AND orderID IS NULL AND addressSlug='default'
[1] SELECT * FROM perch2_shop_cart WHERE cartID=18
[1] SELECT * FROM perch2_shop_cart WHERE cartID=18
INSERT INTO perch2_shop_orders(orderStatus,orderGateway,orderTotal,currencyID,orderItemsSubtotal,orderItemsTax,orderItemsTotal,orderShippingSubtotal,orderShippingDiscounts,orderShippingTax,orderShippingTaxDiscounts,orderShippingTotal,orderDiscountsTotal,orderTaxDiscountsTotal,orderSubtotal,orderTaxTotal,orderItemsRefunded,orderTaxRefunded,orderShippingRefunded,orderTotalRefunded,orderTaxID,orderShippingWeight,orderCreated,orderPricing,orderDynamicFields,customerID,shippingID,orderShippingTaxRate,orderBillingAddress,orderShippingAddress) VALUES('created','paypal_express','18.15','47','18.15','0.00',18.15,'0.00','0.00','0.00','0.00','0.00','0.00','0.00',18.15,'0.00',0,0,0,0,NULL,'0.00','2016-05-19 13:43:22','standard','[]','7',NULL,0,'114','114')
[1] SELECT * FROM perch2_shop_orders WHERE orderID='63' LIMIT 1
No ids to log.
UPDATE perch2_shop_orders SET orderStatus='created', orderGateway='paypal_express', orderTotal='18.15', currencyID='47', orderItemsSubtotal='18.15', orderItemsTax='0.00', orderItemsTotal=18.15, orderShippingSubtotal='0.00', orderShippingDiscounts='0.00', orderShippingTax='0.00', orderShippingTaxDiscounts='0.00', orderShippingTotal='0.00', orderDiscountsTotal='0.00', orderTaxDiscountsTotal='0.00', orderSubtotal=18.15, orderTaxTotal='0.00', orderItemsRefunded=0, orderTaxRefunded=0, orderShippingRefunded=0, orderTotalRefunded=0, orderTaxID=NULL, orderShippingWeight='0.00', orderCreated='2016-05-19 13:43:22', orderPricing='standard', orderDynamicFields='[]', customerID='7', shippingID=NULL, orderShippingTaxRate=0, orderBillingAddress='114', orderShippingAddress='114', orderUpdated='2016-05-19 13:43:22' WHERE orderID='63'
No ids to log.
[1] SELECT * FROM perch2_shop_addresses WHERE addressID=114
INSERT INTO perch2_shop_addresses(addressTitle,addressSlug,addressFirstName,addressLastName,addressCompany,addressLine1,addressDynamicFields,addressCreated,addressUpdated,addressDeleted,customerID,countryID,regionID,orderID) VALUES('default','default','Test','Test','Boiler Room Digital','Address','{\"first_name\":\"Test\",\"last_name\":\"Test\",\"address_1\":\"Address\",\"address_2\":\"Address\",\"postcode\":\"AB1 2CD\",\"country\":\"236\",\"company\":\"Boiler Room Digital\",\"city\":\"City\",\"county\":\"County\",\"customer\":\"7\"}','2016-05-19 13:43:22','2016-05-19 13:43:22',NULL,'7','236',NULL,63)
UPDATE perch2_shop_orders SET orderBillingAddress='115', orderShippingAddress='115', orderUpdated='2016-05-19 13:43:22' WHERE orderID='63'
No ids to log.
INSERT INTO perch2_shop_order_items(itemType,orderID,productID,itemPrice,itemTax,itemTotal,itemQty,itemTaxRate,itemDiscount,itemTaxDiscount) VALUES('product','63','2','17.36','0.00','17.36','1',0,0,0)
[1] SELECT * FROM perch2_shop_order_items WHERE itemID='65' LIMIT 1
No ids to log.
UPDATE perch2_shop_order_items SET itemType='product', orderID='63', productID='2', itemPrice='17.36', itemTax='0.00', itemTotal='17.36', itemQty='1', itemTaxRate=0, itemDiscount=0, itemTaxDiscount=0 WHERE itemID='65'
No ids to log.
INSERT INTO perch2_shop_order_items(itemType,orderID,productID,itemPrice,itemTax,itemTotal,itemQty,itemTaxRate,itemDiscount,itemTaxDiscount) VALUES('product','63','34','0.01','0.00','0.01','79',0,0,0)
[1] SELECT * FROM perch2_shop_order_items WHERE itemID='66' LIMIT 1
No ids to log.
UPDATE perch2_shop_order_items SET itemType='product', orderID='63', productID='34', itemPrice='0.01', itemTax='0.00', itemTotal='0.01', itemQty='79', itemTaxRate=0, itemDiscount=0, itemTaxDiscount=0 WHERE itemID='66'
No ids to log.
UPDATE perch2_shop_cart_data SET orderID='63' WHERE cartID='18'
INSERT INTO perch2_shop_tax_exhibits(orderID,exhibitType,exhibitDetail,exhibitSource,locationID,countryID,exhibitDate) VALUES(63,'IP_ADDRESS','82.4.157.135','Environment',NULL,NULL,'2016-05-19 13:43:22')
[1] SELECT * FROM perch2_shop_tax_exhibits WHERE exhibitID='159' LIMIT 1
No ids to log.
UPDATE perch2_shop_tax_exhibits SET orderID=63, exhibitType='IP_ADDRESS', exhibitDetail='82.4.157.135', exhibitSource='Environment', locationID=NULL, countryID=NULL, exhibitDate='2016-05-19 13:43:22' WHERE exhibitID='159'
No ids to log.
[1] SELECT * FROM perch2_shop_order_statuses WHERE statusKey='created' AND statusActive=1 AND statusDeleted IS NULL
[nil] SELECT * FROM perch2_shop_emails WHERE emailStatus=1 AND emailActive=1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID='47' LIMIT 1
[1] SELECT * FROM perch2_shop_customers WHERE customerID='7' AND customerDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_addresses WHERE addressID=115 AND addressDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_addresses WHERE addressID=115 AND addressDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_shop_countries WHERE countryID='236' LIMIT 1
[1] SELECT * FROM perch2_shop_countries WHERE countryID='236' LIMIT 1
Payment failed
Omnipay\PayPal\Message\ExpressAuthorizeResponse Object
(
    [liveCheckoutEndpoint:protected] => https://www.paypal.com/cgi-bin/webscr
    [testCheckoutEndpoint:protected] => https://www.sandbox.paypal.com/cgi-bin/webscr
    [request:protected] => Omnipay\PayPal\Message\ExpressAuthorizeRequest Object
        (
            [liveEndpoint:protected] => https://api-3t.paypal.com/nvp
            [testEndpoint:protected] => https://api-3t.sandbox.paypal.com/nvp
            [parameters:protected] => Symfony\Component\HttpFoundation\ParameterBag Object
                (
                    [parameters:protected] => Array
                        (
                            [username] => 
                            [password] => 
                            [signature] => 
                            [testMode] => 
                            [solutionType] => Sole
                            [landingPage] => Billing
                            [brandName] => 
                            [headerImageUrl] => 
                            [logoImageUrl] => 
                            [borderColor] => 
                            [returnUrl] => https://dev.DOMAIN.org.uk/confirm/
                            [cancelUrl] => https://dev.DOMAIN.org.uk/cancel/
                            [amount] => 18.15
                            [currency] => GBP
                            [transactionId] => 63
                            [clientIp] => 82.4.157.135
                            [description] => Order #63
                            [card] => Omnipay\Common\CreditCard Object
                                (
                                    [supported_cards:protected] => Array
                                        (
                                            [visa] => /^4\d{12}(\d{3})?$/
                                            [mastercard] => /^(5[1-5]\d{4}|677189)\d{10}$/
                                            [discover] => /^(6011|65\d{2}|64[4-9]\d)\d{12}|(62\d{14})$/
                                            [amex] => /^3[47]\d{13}$/
                                            [diners_club] => /^3(0[0-5]|[68]\d)\d{11}$/
                                            [jcb] => /^35(28|29|[3-8]\d)\d{12}$/
                                            [switch] => /^6759\d{12}(\d{2,3})?$/
                                            [solo] => /^6767\d{12}(\d{2,3})?$/
                                            [dankort] => /^5019\d{12}$/
                                            [maestro] => /^(5[06-8]|6\d)\d{10,17}$/
                                            [forbrugsforeningen] => /^600722\d{10}$/
                                            [laser] => /^(6304|6706|6709|6771(?!89))\d{8}(\d{4}|\d{6,7})?$/
                                        )

                                    [parameters:protected] => Symfony\Component\HttpFoundation\ParameterBag Object
                                        (
                                            [parameters:protected] => Array
                                                (
                                                    [billingFirstName] => Test
                                                    [shippingFirstName] => Test
                                                    [billingLastName] => Test
                                                    [shippingLastName] => Test
                                                    [billingAddress1] => Address
                                                    [billingAddress2] => Address
                                                    [billingCity] => City
                                                    [billingPostcode] => AB1 2CD
                                                    [billingState] => County
                                                    [billingCountry] => GB
                                                    [shippingAddress1] => Address
                                                    [shippingAddress2] => Address
                                                    [shippingCity] => City
                                                    [shippingPostcode] => AB1 2CD
                                                    [shippingState] => County
                                                    [shippingCountry] => GB
                                                    [billingCompany] => 
                                                    [shippingCompany] => 
                                                    [email] => info@domain.com
                                                )

                                        )

                                )

                            [transactionReference] => 63
                        )

                )

            [httpClient:protected] => Guzzle\Http\Client Object
                (
                    [defaultHeaders:protected] => Guzzle\Common\Collection Object
                        (
                            [data:protected] => Array
                                (
                                )

                        )

                    [userAgent:protected] => Guzzle/3.9.3 curl/7.38.0 PHP/5.6.19-0+deb8u1
                    [config:Guzzle\Http\Client:private] => Guzzle\Common\Collection Object
                        (
                            [data:protected] => Array
                                (
                                    [curl.options] => Array
                                        (
                                            [78] => 60
                                            [10065] => /PATH_TO_WEB_ROOT/web/content/perch/addons/apps/perch_shop/lib/vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem
                                            [64] => 1
                                            [81] => 2
                                        )

                                )

                        )

                    [baseUrl:Guzzle\Http\Client:private] => 
                    [curlMulti:Guzzle\Http\Client:private] => Guzzle\Http\Curl\CurlMultiProxy Object
                        (
                            [handles:protected] => Array
                                (
                                    [0] => Guzzle\Http\Curl\CurlMulti Object
                                        (
                                            [multiHandle:protected] => Resource id #214
                                            [requests:protected] => Array
                                                (
                                                )

                                            [handles:protected] => SplObjectStorage Object
                                                (
                                                    [storage:SplObjectStorage:private] => Array
                                                        (
                                                        )

                                                )

                                            [resourceHash:protected] => Array
                                                (
                                                )

                                            [exceptions:protected] => Array
                                                (
                                                )

                                            [successful:protected] => Array
                                                (
                                                )

                                            [multiErrors:protected] => Array
                                                (
                                                    [1] => Array
                                                        (
                                                            [0] => CURLM_BAD_HANDLE
                                                            [1] => The passed-in handle is not a valid CURLM handle.
                                                        )

                                                    [2] => Array
                                                        (
                                                            [0] => CURLM_BAD_EASY_HANDLE
                                                            [1] => An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle.
                                                        )

                                                    [3] => Array
                                                        (
                                                            [0] => CURLM_OUT_OF_MEMORY
                                                            [1] => You are doomed.
                                                        )

                                                    [4] => Array
                                                        (
                                                            [0] => CURLM_INTERNAL_ERROR
                                                            [1] => This can only be returned if libcurl bugs. Please report it to us!
                                                        )

                                                )

                                            [selectTimeout:protected] => 1
                                            [eventDispatcher:protected] => Symfony\Component\EventDispatcher\EventDispatcher Object
                                                (
                                                    [listeners:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                                        (
                                                        )

                                                    [sorted:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                                        (
                                                        )

                                                )

                                        )

                                )

                            [groups:protected] => Array
                                (
                                )

                            [queued:protected] => Array
                                (
                                )

                            [maxHandles:protected] => 3
                            [selectTimeout:protected] => 1
                            [eventDispatcher:protected] => Symfony\Component\EventDispatcher\EventDispatcher Object
                                (
                                    [listeners:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                        (
                                        )

                                    [sorted:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                        (
                                        )

                                )

                        )

                    [uriTemplate:Guzzle\Http\Client:private] => Guzzle\Parser\UriTemplate\UriTemplate Object
                        (
                            [template:Guzzle\Parser\UriTemplate\UriTemplate:private] => 
                            [variables:Guzzle\Parser\UriTemplate\UriTemplate:private] => 
                            [regex:Guzzle\Parser\UriTemplate\UriTemplate:private] => /\{([^\}]+)\}/
                        )

                    [requestFactory:protected] => Guzzle\Http\Message\RequestFactory Object
                        (
                            [methods:protected] => Array
                                (
                                    [getInstance] => 0
                                    [__construct] => 1
                                    [fromMessage] => 2
                                    [fromParts] => 3
                                    [create] => 4
                                    [cloneRequestWithMethod] => 5
                                    [applyOptions] => 6
                                    [visit_headers] => 7
                                    [visit_body] => 8
                                    [visit_allow_redirects] => 9
                                    [visit_auth] => 10
                                    [visit_query] => 11
                                    [visit_cookies] => 12
                                    [visit_events] => 13
                                    [visit_plugins] => 14
                                    [visit_exceptions] => 15
                                    [visit_save_to] => 16
                                    [visit_params] => 17
                                    [visit_timeout] => 18
                                    [visit_connect_timeout] => 19
                                    [visit_debug] => 20
                                    [visit_verify] => 21
                                    [visit_proxy] => 22
                                    [visit_cert] => 23
                                    [visit_ssl_key] => 24
                                )

                            [requestClass:protected] => Guzzle\Http\Message\Request
                            [entityEnclosingRequestClass:protected] => Guzzle\Http\Message\EntityEnclosingRequest
                        )

                    [eventDispatcher:protected] => Symfony\Component\EventDispatcher\EventDispatcher Object
                        (
                            [listeners:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                (
                                    [request.sent] => Array
                                        (
                                            [100] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [0] => Guzzle\Http\RedirectPlugin Object
                                                                (
                                                                    [defaultMaxRedirects:protected] => 5
                                                                )

                                                            [1] => onRequestSent
                                                        )

                                                )

                                        )

                                    [request.clone] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [0] => Guzzle\Http\RedirectPlugin Object
                                                                (
                                                                    [defaultMaxRedirects:protected] => 5
                                                                )

                                                            [1] => cleanupRequest
                                                        )

                                                )

                                        )

                                    [request.before_send] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [0] => Guzzle\Http\RedirectPlugin Object
                                                                (
                                                                    [defaultMaxRedirects:protected] => 5
                                                                )

                                                            [1] => cleanupRequest
                                                        )

                                                )

                                        )

                                )

                            [sorted:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array
                                (
                                )

                        )

                )

            [httpRequest:protected] => Symfony\Component\HttpFoundation\Request Object
                (
                    [attributes] => Symfony\Component\HttpFoundation\ParameterBag Object
                        (
                            [parameters:protected] => Array
                                (
                                )

                        )

                    [request] => Symfony\Component\HttpFoundation\ParameterBag Object
                        (
                            [parameters:protected] => Array
                                (
                                    [first_name] => Test
                                    [last_name] => Test
                                    [email] => info@domain.com
                                    [password] => __auto__
                                    [company] => Boiler Room Digital
                                    [address_1] => Address
                                    [address_2] => Address
                                    [city] => City
                                    [county] => County
                                    [postcode] => AB1 2CD
                                    [country] => 236
                                    [cms-form] => cmVnaXN0ZXI6cGVyY2hfc2hvcDovdGVtcGxhdGVzL3Nob3AvY2hlY2tvdXQvY3VzdG9tZXJfY3JlYXRlX3Bhc3N3b3JkbGVzcy5odG1sOjE0NjM2NjUzNzk=
                                )

                        )

                    [query] => Symfony\Component\HttpFoundation\ParameterBag Object
                        (
                            [parameters:protected] => Array
                                (
                                )

                        )

                    [server] => Symfony\Component\HttpFoundation\ServerBag Object
                        (
                            [parameters:protected] => Array
                                (
                                    [UNIQUE_ID] => Vz3C@n8AAQEAAFUZiY8AAAAH
                                    [PHP_DOCUMENT_ROOT] => /PATH_TO_WEB_ROOT/web/content
                                    [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17
                                    [HTTP_X_FORWARDED_FOR] => 82.4.157.135
                                    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
                                    [CONTENT_TYPE] => application/x-www-form-urlencoded
                                    [HTTP_ACCEPT_LANGUAGE] => en-us
                                    [HTTP_HOST] => dev.DOMAIN.org.uk
                                    [HTTP_REFERER] => https://dev.DOMAIN.org.uk/checkout/
                                    [HTTP_X_MOSSO_DT] => PHP56-23 VS
                                    [HTTP_ORIGIN] => https://dev.DOMAIN.org.uk
                                    [HTTP_COOKIE] => PHPSESSID=5v5303nb51g2k4d87isvv9eq16; X-Mapping-akpehfea=4AFFD4512BB2F0F6CA6E0ED54FC8D2E5; cmsa=1; p_m=
                                    [HTTP_CONNECTION] => keep-alive
                                    [HTTP_ACCEPT_ENCODING] => gzip, deflate
                                    [HTTP_DNT] => 1
                                    [CONTENT_LENGTH] => 334
                                    [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
                                    [SERVER_SIGNATURE] => 
Apache/2.4 Server at dev.DOMAIN.org.uk Port 80


                                    [SERVER_SOFTWARE] => Apache/2.4
                                    [SERVER_NAME] => dev.DOMAIN.org.uk
                                    [SERVER_ADDR] => 10.187.248.98
                                    [SERVER_PORT] => 80
                                    [REMOTE_ADDR] => 82.4.157.135
                                    [DOCUMENT_ROOT] => /PATH_TO_WEB_ROOT/web/content
                                    [REQUEST_SCHEME] => http
                                    [CONTEXT_PREFIX] => 
                                    [CONTEXT_DOCUMENT_ROOT] => /PATH_TO_WEB_ROOT/web/content
                                    [SERVER_ADMIN] => root@localhost
                                    [SCRIPT_FILENAME] => /PATH_TO_WEB_ROOT/web/content/checkout/index.php
                                    [REMOTE_PORT] => 12344
                                    [GATEWAY_INTERFACE] => CGI/1.1
                                    [SERVER_PROTOCOL] => HTTP/1.1
                                    [REQUEST_METHOD] => POST
                                    [QUERY_STRING] => 
                                    [REQUEST_URI] => /checkout/
                                    [SCRIPT_NAME] => /checkout/index.php
                                    [PHP_SELF] => /checkout/index.php
                                    [REQUEST_TIME_FLOAT] => 1463665402.08
                                    [REQUEST_TIME] => 1463665402
                                    [argv] => Array
                                        (
                                        )

                                    [argc] => 0
                                )

                        )

                    [files] => Symfony\Component\HttpFoundation\FileBag Object
                        (
                            [parameters:protected] => Array
                                (
                                )

                        )

                    [cookies] => Symfony\Component\HttpFoundation\ParameterBag Object
                        (
                            [parameters:protected] => Array
                                (
                                    [PHPSESSID] => 5v5303nb51g2k4d87isvv9eq16
                                    [X-Mapping-akpehfea] => 4AFFD4512BB2F0F6CA6E0ED54FC8D2E5
                                    [cmsa] => 1
                                    [p_m] => 751c86eb63fc87add806b43cef43c2bcaafbd44f
                                )

                        )

                    [headers] => Symfony\Component\HttpFoundation\HeaderBag Object
                        (
                            [headers:protected] => Array
                                (
                                    [user-agent] => Array
                                        (
                                            [0] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17
                                        )

                                    [x-forwarded-for] => Array
                                        (
                                            [0] => 82.4.157.135
                                        )

                                    [accept] => Array
                                        (
                                            [0] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
                                        )

                                    [content-type] => Array
                                        (
                                            [0] => application/x-www-form-urlencoded
                                        )

                                    [accept-language] => Array
                                        (
                                            [0] => en-us
                                        )

                                    [host] => Array
                                        (
                                            [0] => dev.DOMAIN.org.uk
                                        )

                                    [referer] => Array
                                        (
                                            [0] => https://dev.DOMAIN.org.uk/checkout/
                                        )

                                    [x-mosso-dt] => Array
                                        (
                                            [0] => PHP56-23 VS
                                        )

                                    [origin] => Array
                                        (
                                            [0] => https://dev.DOMAIN.org.uk
                                        )

                                    [cookie] => Array
                                        (
                                            [0] => PHPSESSID=5v5303nb51g2k4d87isvv9eq16; X-Mapping-akpehfea=4AFFD4512BB2F0F6CA6E0ED54FC8D2E5; cmsa=1; p_m=
                                        )

                                    [connection] => Array
                                        (
                                            [0] => keep-alive
                                        )

                                    [accept-encoding] => Array
                                        (
                                            [0] => gzip, deflate
                                        )

                                    [dnt] => Array
                                        (
                                            [0] => 1
                                        )

                                    [content-length] => Array
                                        (
                                            [0] => 334
                                        )

                                )

                            [cacheControl:protected] => Array
                                (
                                )

                        )

                    [content:protected] => 
                    [languages:protected] => 
                    [charsets:protected] => 
                    [encodings:protected] => 
                    [acceptableContentTypes:protected] => 
                    [pathInfo:protected] => 
                    [requestUri:protected] => 
                    [baseUrl:protected] => 
                    [basePath:protected] => 
                    [method:protected] => 
                    [format:protected] => 
                    [session:protected] => 
                    [locale:protected] => 
                    [defaultLocale:protected] => en
                )

            [response:protected] => Omnipay\PayPal\Message\ExpressAuthorizeResponse Object
 *RECURSION*
            [zeroAmountAllowed:protected] => 1
            [negativeAmountAllowed:protected] => 
        )

    [data:protected] => Array
        (
            [TIMESTAMP] => 2016-05-19T13:43:22Z
            [CORRELATIONID] => 16b5860bcad96
            [ACK] => Failure
            [VERSION] => 119.0
            [BUILD] => 000000
            [L_ERRORCODE0] => 10002
            [L_SHORTMESSAGE0] => Authentication/Authorization Failed
            [L_LONGMESSAGE0] => You do not have permissions to make this API call
            [L_SEVERITYCODE0] => Error
        )

)
Setting order status to payment_failed
UPDATE perch2_shop_orders SET orderDynamicFields='{\"status\":\"payment_failed\"}', orderStatus='payment_failed', orderUpdated='2016-05-19 13:43:22' WHERE orderID='63'
No ids to log.
[1] SELECT * FROM perch2_shop_order_statuses WHERE statusKey='payment_failed' AND statusActive=1 AND statusDeleted IS NULL
[nil] SELECT * FROM perch2_shop_emails WHERE emailStatus=2 AND emailActive=1
Redirect held: https://dev.DOMAIN.org.uk/cancel/
[9] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
[0] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/checkout/index.php' LIMIT 1
[9] Using template: /templates/navigation/bootstrap-nav.html
Using cart from cache.
Using template: /templates/shop/cart/mini_cart.html
[9] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
[0] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/checkout/index.php' LIMIT 1
[9] Using template: /templates/navigation/bootstrap-nav.html
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Testimonials' AND (regionPage='/checkout/index.php' OR regionPage='*')
[1] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='text' WHERE ((idx.regionID=32 AND idx.itemRev=3)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY RAND() LIMIT 0, 1
[1] Using template: /templates/content/blocks/quote.html
[2] SELECT * FROM perch2_twitter_tweets WHERE tweetType='mine' ORDER BY tweetDate DESC LIMIT 2
[2] Using template: /addons/apps/perch_twitter/templates/twitter/tweet.html
Drew McLellan

Drew McLellan 2638 points
Perch Support

Looks like possible curl issues on your server. Which version are you running? Are your root certificates up to date?

It is managed hosting with Rackspace Cloud. I am told that curl version is 7.38.0 and re the root certificates "we follow the debian repository for valid certificates" so they say they're up to date.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. This isn't an issue I've seen before, and it looks to be environment related. I don't have a solution to suggest for you at the moment.

OK. Should it work on my MAMP Pro setup which also shows an error despite being a different environment?

As a further thought, I have another site on the same hosting (Rackspace Cloud Sites) which is running Expression Engine/Cartthrob - this is able to connect to PayPal without a problem. Having chatted to Rackspace Support they say that it's trying to do the curl but being denied permission. I can send you FTPs to my dev server if it helps.

If it can't be resolved, do you have a suggested course of action? Different hosting? Different Payment Gateway?

Thanks so much for your help.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Which version of the PayPal API is it using? We're using the newest version, which has more modern SSL requirements.

I think version 65.1 - that's the version indicated in the PayPal Express code.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, that's not something I recognise - I'll have to do some research.

I may be wrong about that Cartthrob version number. I have tried a number of different API credentials, including those that work on the other site, and still hitting up against the same issue. Thanks, Drew.

Sorry to chase - I just want to be clear on the situation. I have a site that is not far off ready to launch apart from a non-functioning checkout. The client really wants to use PayPal, and my Rackspace Cloud Sites Hosting works well for all my other sites and is something I'm already paying for. Just would be helpful to know what you suggest.

Appreciate you are busy, but I'm kind of stuck. Happy for you to have FTP access or provide anything else I can to help you resolve.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You're basically asking me why your hosting can't talk to the PayPal API. Obviously I'll try to help but being in control of neither your hosting nor the PayPal API I might not be the best placed person to investigate it.

Presumably you're not on dev.DOMAIN.org.uk and you've edited the output. Is there anything else you've edited?

Yes, I edited that and also replaced part of the full server path with PATH_TO, really just for privacy.

I can appreciate you've no control over my hosting or PayPal API. I don't think it's something I have the PHP chops to fix, and I don't think I'll get help from Rackspace (who'll say it's beyond the scope of what they can support) or PayPal. So I guess I was hoping you could point me in the right direction.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I've googled the error and found this page below. Does it apply to your circumstance too?

https://help.tictail.com/hc/en-us/articles/205660201-Paypal-error-You-do-not-have-permissions-to-make-this-API-call-

I saw that - fairly sure it doesn't apply in this instance. I've tried it with a PayPal account that is able to take payments from the Expression Engine site I mentioned..

Do you find that Perch Shop can check out from a local server or does it need to be web accessible? I would think it would still redirect to PayPal successfully? (The fact that my local server also throws the error makes me think it may not be hosting related, but I've configured something incorrectly.).

Drew McLellan

Drew McLellan 2638 points
Perch Support

It should (and does) work fine locally - you don't need to be on a live server or set up a tunnel to get any callbacks.

Is the error the same locally?

I just got a "fatal error" on my local server. I don't think I tried it with halting redirects, so can do that tomorrow. My local server is just a standard MAMP Pro.