Post by webnurse » Tue Nov 13, 2018 1:14 pm

I have installed the Paypal Express payment module for OC 2.2.0.0. Everything goes fine with adding to the cart, getting to the final window from Paypal. When I submit the order, I get a "security header not valid" error. I have refreshed my modifications, double checked my API credentials (and pasted them directly from Paypal). Not running sandbox. Any ideas? I am running a custom theme so I don't want to upgrade to 3.x. This is the client's last step to opening her store, so I really would hate to have to start at square 1 again.

Newbie

Posts

Joined
Thu Oct 18, 2018 3:55 am

Post by straightlight » Tue Nov 13, 2018 7:01 pm

I am running a custom theme so I don't want to upgrade to 3.x.
PayPal do make changes frequently to their APIs. If upgrading to a higher OC version is not an option for you, either download an extension from the Marketplace or create a new service request in the Commercial Support section of the forum to get this done as a custom job.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ADD Creative » Tue Nov 13, 2018 10:48 pm

Check your API credentials again. It could be that the copy and paste added some spaces of other extra characters.

Do any of your PayPal API credentials contain the following?

Code: Select all

& " < >

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by webnurse » Wed Nov 14, 2018 4:07 am

ADD Creative, thank you for responding. With respect to the special characters, the only ones I see in my credentials are hyphen (-) and underscore (_). None of the characters you noted. I have also confirmed that no spaces are present.
Last edited by webnurse on Wed Nov 14, 2018 4:09 am, edited 1 time in total.

Newbie

Posts

Joined
Thu Oct 18, 2018 3:55 am

Post by webnurse » Wed Nov 14, 2018 4:08 am

@Straightlight, can you recommend any of the extensions? I have been browsing them but do not seem to find any that would fit this bill. Thank you so much again.

Newbie

Posts

Joined
Thu Oct 18, 2018 3:55 am

Post by ADD Creative » Wed Nov 14, 2018 5:08 am

PayPal Express is working fine on a store using version 2.3.0.2, which in not that different to 2.2.0.0. If there had been an change in PayPal's API there would be loads of people posting about their problems. So it's still most likely that there is a problem with your API credentials.

What has worked for some people is to do the following.
1. Uninstall the PayPal Express Checkout extension in OpenCart
2. Regenerate the API credentials in PayPal
3. Reinstall the PayPal Express Checkout extension in OpenCart
4. Enter the new credentials
5. Make sure Test (Sandbox) Mode is set to No in the settings
6. Save settings

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by webnurse » Wed Nov 14, 2018 6:01 am

I'm afraid Murphy's Law has become part of my DNA. I had actually done the uninstall/reinstall/regenerate API before I came here. No luck. I should have mentioned that, sorry.

Newbie

Posts

Joined
Thu Oct 18, 2018 3:55 am

Post by straightlight » Wed Nov 14, 2018 6:11 am

This topic may be useful to fix the URL encoding, however: https://github.com/opencart/opencart/issues/6602 .

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ADD Creative » Wed Nov 14, 2018 7:48 am

May not be any help to you, but I use the following code in a .php file to test API credentials. Just replace the username, password and signature.
If you see "L_LONGMESSAGE0=Order total is missing." in the result then your API credentials are working.

If you see "L_LONGMESSAGE0=Security header is not valid" in the result then there is a problem with them or your connection to PayPal.

Code: Select all

<?php
//	$url = 'https://api-3t.sandbox.paypal.com/nvp';
	$url = 'https://api-3t.paypal.com/nvp';

	$data = array(
		'USER'      => 'username',
		'PWD'       => 'password',
		'SIGNATURE' => 'signature',
		'VERSION'   => '109.0',
		'METHOD'    => 'SetExpressCheckout'
	);

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_HEADER, false);
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	echo urldecode(curl_exec($ch));
	curl_close($ch);
?>

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 21 guests