Support

Home Forums Event Espresso Premium Paypal Commerce will not activate

Paypal Commerce will not activate

Posted: September 27, 2024 at 11:46 am

Viewing 12 reply threads


HerbalEducation

September 27, 2024 at 11:46 am

We are switching from Paypal Pro to Paypal Commerce. We follow the steps to “Connect with Paypal” which seems to be successful on the Paypal side (in the Paypal account). However, nothing changes in the EE/Paypal Commerce plugin: so we do not get the “connected” message, just the “Connect with Paypal (sandbox)” button remains. We have tried to clear cache and “clear Paypal Commerce metadata” and retried a few times. If we try to purchase a ticket on the front-end we get an error “no payment method is active.”

Can you please advise?


Tony

  • Support Staff

September 27, 2024 at 2:30 pm

Hi there,

This message – “Connect with Paypal (sandbox)”

Means you have the payment method in debug mode and a sandbox account is separate from your live account.

In the payment method settings make sure ‘Sandbox Mode On’ is set to No and then try to connect to PayPal.

Does it work then?


HerbalEducation

September 28, 2024 at 10:41 am

Ok we tried again and there is no change (still says “Connect with Paypal”). Please advise.


HerbalEducation

September 28, 2024 at 10:42 am

No. We tried again and there is no change (still says “Connect with Paypal”). Please advise.


HerbalEducation

September 28, 2024 at 10:43 am

No. We tried again and there is no change (still says “Connect with Paypal”). Please advise.


Tony

  • Support Staff

September 30, 2024 at 7:05 am

Hi there,

Can I take a look at the site?

I’d like to try connecting my account and see if there are any errors thrown in the background (I’ll obviously disconnect again if it works etc)

If that’s ok, just send temp login details over using this form:

https://eventespresso.com/send-login-details/


Tony

  • Support Staff

October 1, 2024 at 4:44 am

Can you please try again and let me know if it works this time?


HerbalEducation

October 1, 2024 at 12:22 pm

Ok it looks like the connection was successful but please see the attached (screen shot) error when attempting a ticket purchase…. Error response… Paypal Commerce checkout Javascript was not loaded properly… can’t be processed.


Tony

  • Support Staff

October 2, 2024 at 7:05 am

Hmm, something very weird going on there.

The PayPal .js file (which loads directly from PayPal) isn’t getting any query parameters passed to the file when we call it. Even if you have zero details from your account there are hardcoded values that must be sent when loading that .js file, but none of those are being passed.

Can I add some debug code to the site to see what is happening? I’ll need FTP access if that’s the ok:

https://eventespresso.com/send-login-details/


HerbalEducation

October 2, 2024 at 10:43 am

Yes please do whatever is needed. I sent you all login and FTP details a few days ago. Do you need them again?


Tony

  • Support Staff

October 2, 2024 at 4:21 pm

My apologies, you’ve submitted the form twice, the second one (which I had open at the time of my above reply) just has WP Admin creds, but the first included both and I didn’t check.

Ok, so the issue here is from code within the theme:

function _remove_script_version( $src ){
	$parts = explode( '?', $src );
	return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );

Thats in \themes\{theme}\functions.php

That code takes all scripts loading on the site and removes everything within the query string, not just version numbers.

So when we try to enqueue the PayPal SDK and pass in the required details, we say the script URL is something like:

https://www.paypal.com/sdk/js?client-id={ID}&currency={currency}&componants=buttons,hosted-fields....

The above code then hooks and removes everything after the ? so it just becomes

https://www.paypal.com/sdk/js

That’s why you’re getting the current issue with PayPal.

You’ll need to remove that code from the site, or if you really want to use it, you can check the handle of scripts you are processing and exclude at least the PayPal SDK handle.

https://developer.wordpress.org/reference/hooks/script_loader_src/


HerbalEducation

October 6, 2024 at 1:29 pm

Ok, that seems to have worked. Thank you!


Tony

  • Support Staff

October 7, 2024 at 2:32 am

You’re most welcome.

Any further issues just let me know.

Viewing 12 reply threads

You must be logged in to reply to this support post. Sign In or Register for an Account

Event Espresso