Fix for OpenCart Error: The security header is not valid

Posted Feb 23, 2015
Last Updated Feb 24, 2015

I've been working with OpenCart for the past couple days and ran into a problem that had many posts on the Internet with no solutions in my searches. So if you a problem with the PayPal Express Checkout in OpenCart, you may find a solution below.

The error on checkout was always this: "The security header is not valid"

What I did to solve this in the OpenCart Administration:

  1. In System > Users > APIs: Deleted the API user.*
  2. In Extensions > Payments, Uninstalled Paypal Express Checkout.
  3. Reinstalled Express Checkout.
  4. Re-entered the Paypal API info.

* Although in my case, I started with deleting the API user, I don't think it was actually necessary. I'd skip step 1 as a test if you have that problem.

Comment

No HTML Tags are permitted.

Ricardo Vidallon

Oct 19, 2019

Thanks for the post. Worked like a charm using PayPal / Open Cart Version 2.3.0.2 using the following steps:

In System > Users > APIs: Deleted the API user.*
In Extensions > Payments, Uninstalled Paypal Express Checkout.
Reinstalled Express Checkout.
Re-entered the Paypal API info.

GRH

Oct 11, 2017

Thanks, just what I needed after looking at various dead ends and convoluted 'solutions' that didn't work.

It isn't necessary to delete the API as in step one as I didn't and it all just worked.

Thanks again.

Joel Vilela

May 11, 2017

Hi, in my case is not working :o(
I have OC version 2.3.2 and i am working in localhost.
When i try to pay with PayPal Express Checkout i have this erros.

2017-05-11 17:23:55 - PayPal Express debug (Call data): {"METHOD":"SetExpressCheckout","MAXAMT":151.5,"RETURNURL":"http:\/\/localhost\/pancho\/index.php?route=extension\/payment\/pp_express\/checkoutReturn","CANCELURL":"http:\/\/localhost\/pancho\/index.php?route=checkout\/checkout","REQCONFIRMSHIPPING":0,"NOSHIPPING":0,"LOCALECODE":"EN","LANDINGPAGE":"Login","HDRIMG":null,"PAYFLOWCOLOR":"","CHANNELTYPE":"Merchant","ALLOWNOTE":"0","PAYMENTREQUEST_0_SHIPTONAME":"webcorvo","PAYMENTREQUEST_0_SHIPTOSTREET":"Lisboa","PAYMENTREQUEST_0_SHIPTOSTREET2":"","PAYMENTREQUEST_0_SHIPTOCITY":"Lisboa","PAYMENTREQUEST_0_SHIPTOSTATE":"Lisboa","PAYMENTREQUEST_0_SHIPTOZIP":"1700","PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE":"PT","PAYMENTREQUEST_0_SHIPPINGAMT":"","PAYMENTREQUEST_0_CURRENCYCODE":"EUR","PAYMENTREQUEST_0_PAYMENTACTION":"Sale","L_PAYMENTREQUEST_0_DESC0":"","L_PAYMENTREQUEST_0_NAME0":"iPhone","L_PAYMENTREQUEST_0_NUMBER0":"product 11","L_PAYMENTREQUEST_0_AMT0":101,"L_PAYMENTREQUEST_0_QTY0":"1","L_PAYMENTREQUEST_0_ITEMURL0":"http:\/\/localhost\/pancho\/index.php?route=product\/product&product_id=40","L_PAYMENTREQUEST_0_NUMBER1":"shipping","L_PAYMENTREQUEST_0_NAME1":"Expedi\u00e7\u00e3o normal","L_PAYMENTREQUEST_0_AMT1":5,"L_PAYMENTREQUEST_0_QTY1":1,"PAYMENTREQUEST_0_ITEMAMT":"106.00","PAYMENTREQUEST_0_AMT":"106.00"}
2017-05-11 17:23:55 - PayPal Express debug (Result): "TIMESTAMP=2017%2d05%2d11T15%3a23%3a50Z&CORRELATIONID=7709a3e32f369&ACK=Failure&VERSION=109%2e0&BUILD=33490117&L_ERRORCODE0=10002&L_SHORTMESSAGE0=Security%20error&L_LONGMESSAGE0=Security%20header%20is%20not%20valid&L_SEVERITYCODE0=Error"
2017-05-11 17:23:55 - Unable to create Paypal session{"TIMESTAMP":"2017-05-11T15:23:50Z","CORRELATIONID":"7709a3e32f369","ACK":"Failure","VERSION":"109.0","BUILD":"33490117","L_ERRORCODE0":"10002","L_SHORTMESSAGE0":"Security error","L_LONGMESSAGE0":"Security header is not valid","L_SEVERITYCODE0":"Error"}

Could you help?
Tks

Colinb

Jan 6, 2017

Found the same issue, i had copied and pasted from Paypal site with credentials, it had copied in some leading spaces in one of the fields. took those out all worked fine so maybe worth checking the enties are correct in their fields. This article helped me go back and find the issue, so thanks for that.

Fabian

Sep 5, 2015

Gracias. Fue la soluciĆ³n!!!!

Shawn Olson

Sep 5, 2015

You are welcome.
Wall Worm plugins and scripts for 3ds Max