Forum

Thread tagged as: Problem, Error, Shop

Paypal Shop Checkout Failing

The head of my page is like this.

<?php include('perch/runtime.php'); ?>
<?php
PerchUtil::hold_redirects();
    perch_shop_checkout('paypal-express', [
        'return_url' => './result.php',
        'cancel_url' => './cancel.php'
    ]);
?>
<!doctype html>

The end of the debug output is below.

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] => z.seddon-facilitator_api1.btinternet.com
                            [password] => 8DG5YWPH44T39B5Q
                            [signature] => 
AnJ2HUJsm40z244.ABNEwFR12hcFA7xLu-7NcwLPOMxeoqJDzeenxM6G
                            [testMode] => 1
                            [solutionType] => Sole
                            [landingPage] => Billing
                            [brandName] => 
                            [headerImageUrl] => 
                            [logoImageUrl] => 
                            [borderColor] => 
                            [returnUrl] => ./result.php
                            [cancelUrl] => ./cancel.php
                            [amount] => 600.00
                            [currency] => GBP
                            [transactionId] => 42
                            [clientIp] => ::1
                            [description] => Order #42
                            [card] => Omnipay\Common\CreditCard Object
                                (
                                    [supported_cards:protected] => Array
                                        (
                                            [visa] => /^4\d{12}(\d{3})?$/
                                            [mastercard] => /^(5[1-5]\d{4}|677189)\d{10}$|^(222[1-9]|2[3-6]\d{2}|27[0-1]\d|2720)\d{12}$/
                                            [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] => Fred
                                                    [shippingFirstName] => Fred
                                                    [billingLastName] => Stidston
                                                    [shippingLastName] => Stidston
                                                    [billingAddress1] => 36
                                                    [billingAddress2] => Braemar Rise
                                                    [billingCity] => Salisbury
                                                    [billingPostcode] => SP1 3QD
                                                    [billingState] => Wiltshire
                                                    [billingCountry] => GB
                                                    [shippingAddress1] => 36
                                                    [shippingAddress2] => Braemar Rise
                                                    [shippingCity] => Salisbury
                                                    [shippingPostcode] => SP1 3QD
                                                    [shippingState] => Wiltshire
                                                    [shippingCountry] => GB
                                                    [billingCompany] => 
                                                    [shippingCompany] => 
                                                    [email] => fred@uxusd.com
                                                )

                                        )

                                )

                            [transactionReference] => 42
                        )

                )

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

                        )

                    [userAgent:protected] => Guzzle/3.9.3 curl/7.52.1 PHP/7.2.1
                    [config:Guzzle\Http\Client:private] => Guzzle\Common\Collection Object
                        (
                            [data:protected] => Array
                                (
                                    [curl.options] => Array
                                        (
                                            [78] => 60
                                            [10065] => /Applications/MAMP/htdocs/zoeseddon/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 #187
                                            [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
                                (
                                )

                        )

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

                        )

                    [server] => Symfony\Component\HttpFoundation\ServerBag Object
                        (
                            [parameters:protected] => Array
                                (
                                    [HTTP_HOST] => localhost:8888
                                    [HTTP_COOKIE] => PHPSESSID=g17s02c3vdu2199a6nirsnb1er; p_m=aa787afe645c9cf778af7ea980c27c83eb2eb5e4; __stripe_mid=26e57f70-8078-4f3c-821f-e9a9e2a38e19; cmsa=1
                                    [HTTP_CONNECTION] => keep-alive
                                    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
                                    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
                                    [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6
                                    [HTTP_REFERER] => https://localhost:8888/zoeseddon/cart.php
                                    [HTTP_ACCEPT_LANGUAGE] => en-gb
                                    [HTTP_ACCEPT_ENCODING] => gzip, deflate
                                    [PATH] => /usr/bin:/bin:/usr/sbin:/sbin
                                    [SERVER_SIGNATURE] => 
                                    [SERVER_SOFTWARE] => Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.1 mod_ssl/2.2.34 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0
                                    [SERVER_NAME] => localhost
                                    [SERVER_ADDR] => ::1
                                    [SERVER_PORT] => 8888
                                    [REMOTE_ADDR] => ::1
                                    [DOCUMENT_ROOT] => /Applications/MAMP/htdocs
                                    [SERVER_ADMIN] => you@example.com
                                    [SCRIPT_FILENAME] => /Applications/MAMP/htdocs/zoeseddon/checkout.php
                                    [REMOTE_PORT] => 55684
                                    [GATEWAY_INTERFACE] => CGI/1.1
                                    [SERVER_PROTOCOL] => HTTP/1.1
                                    [REQUEST_METHOD] => GET
                                    [QUERY_STRING] => 
                                    [REQUEST_URI] => /zoeseddon/checkout.php
                                    [SCRIPT_NAME] => /zoeseddon/checkout.php
                                    [PHP_SELF] => /zoeseddon/checkout.php
                                    [REQUEST_TIME_FLOAT] => 1520859371.908
                                    [REQUEST_TIME] => 1520859371
                                    [argv] => Array
                                        (
                                        )

                                    [argc] => 0
                                )

                        )

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

                        )

                    [cookies] => Symfony\Component\HttpFoundation\ParameterBag Object
                        (
                            [parameters:protected] => Array
                                (
                                    [PHPSESSID] => g17s02c3vdu2199a6nirsnb1er
                                    [p_m] => aa787afe645c9cf778af7ea980c27c83eb2eb5e4
                                    [__stripe_mid] => 26e57f70-8078-4f3c-821f-e9a9e2a38e19
                                    [cmsa] => 1
                                )

                        )

                    [headers] => Symfony\Component\HttpFoundation\HeaderBag Object
                        (
                            [headers:protected] => Array
                                (
                                    [host] => Array
                                        (
                                            [0] => localhost:8888
                                        )

                                    [cookie] => Array
                                        (
                                            [0] => PHPSESSID=g17s02c3vdu2199a6nirsnb1er; p_m=aa787afe645c9cf778af7ea980c27c83eb2eb5e4; __stripe_mid=26e57f70-8078-4f3c-821f-e9a9e2a38e19; cmsa=1
                                        )

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

                                    [upgrade-insecure-requests] => Array
                                        (
                                            [0] => 1
                                        )

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

                                    [user-agent] => Array
                                        (
                                            [0] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6
                                        )

                                    [referer] => Array
                                        (
                                            [0] => https://localhost:8888/zoeseddon/cart.php
                                        )

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

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

                                )

                            [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] => 2018-03-12T12:56:13Z
            [CORRELATIONID] => 5ca8e583f0d59
            [ACK] => Failure
            [VERSION] => 119.0
            [BUILD] => 43715881
            [L_ERRORCODE0] => 10002
            [L_SHORTMESSAGE0] => Security error
            [L_LONGMESSAGE0] => Security header is not valid
            [L_SEVERITYCODE0] => Error
        )

)
Fred Stidston

Fred Stidston 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you checked that you're using the right credentials?

Yes, it all matches

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. I don't know of any other reason PayPal would return "Security header is not valid".

I had this error as well. After reaching out to PayPal, they informed me that the PayPal account I was using wasn't verified. Try to get it verified and see if that fixes it.

https://www.paypal.com/us/smarthelp/article/what-does-a-verified-account-status-mean-faq1014#business

That was the issue, thanks. I accidentally added a newline character.