Stripe Pro form integration Error

I have been using the Stripe pro forms within S2Member with no problems until recently. Now all my users are running a problem where they fill out their payment information and submit but get an error. I have tried it myself and likewise gotten the same error. This is what it is saying:

Fatal error: Class ‘Stripe\PaymentMethod’ not found in …(with the directory then listed)

I cannot find anything I have changed that would have caused this. My PayPal integration still works with no issues, just Stripe.

Thoughts?

I have noticed a bit of weirdness with the latest S2member plugin on installation. It seems to get a bit confused as to wheterh the latest plugin is installed or not. If you are gettgin an error “missing class” my best guess is that you Pro plugin did not install properly. Delete it and reinstall it. See if that fixes the problem.

I deleted and re-uploaded. Still have the same issue. It is telling me this now:

Class ‘Stripe\PaymentMethod’ not found in /home4/####/public_html/wp-content/plugins/s2member-pro/src/includes/classes/gateways/stripe/stripe-utilities.inc.php on line 1152

There has been a critical error on your website.

Where the #### is my actual directory that I have blurred out. When I go to line 1152 it says:

$payment_method = \Stripe\PaymentMethod::retrieve($payment_method_id);

Thoughts?

A little more info:

when I do the ctrl+shift+j I see that it is suggesting stripe.js was loaded more than once. Could this be the issue? It isn’t in red font, but maybe it’s the problem?

That error would lead me to believe that your pro plugin is not installed. When you look on your file-system is the pro plugin there and does plugins/s2member-pro/src/includes/classes/gateways/stripe/stripe-utilities.inc.php exist?

Yep, it’s there

Ok. Good. That’s step1. We know the code file is there.

Now, none of my clients have a Stripe issue and they are using the latest version. If there was a generic code issue then I would be seeing it with my clients since the error you are seeing is a mainstream line of code.

After looking at the source-code and given that you had this working for you previously, there are two possibilities;

a) You added a plugin that declares a Stripe namespace; OR;
b) You have a plug-in you have been using for a while that recently added Stripe support and happened to declare a Stripe namespace.

PHP allows a namespace to be declared more than once so that is not the problem. What I am suspecting is that the use of a relative path is confusing the class lookup.

Can you check if any of your other plugins include a Stripe feature.

NOTE: This is not specifically an S2Member bug but I will raise it with @clavaque as something that should be changed. The namespace used should be changed from Stripe to something like S2member-Stripe to avoid plug-in collisions like it appears you are having.

1 Like

This makes sense. Okay, so looking through all the plugins I can see where “Contact Form 7” uses a stripe integration feature. I deactivated it and then ran a test purchase using stripe.

That was it!

You have been a rock star in this! So grateful!

1 Like

Excellent. Glad you are sorted. At least we know what the problem was.

But I will try to follow up with the plugin owner @clavaque and see if we can get the namespace changed so s2member plays well with others.

Although, to be fair to s2member…Contact Form 7 is guilty of the same namespace naming no-no.

Nice job spotting the source of the conflict.

I don’t think it was a namespace problem, or the error would say that (this came up before and a recent s2 update solved it). https://s2member.com/s2member-v200221-now-available/

I see that it is suggesting stripe.js was loaded more than once

The stripe.js, would not give the error mentioned “Class ‘Stripe\PaymentMethod’ not found”. It seems like the Stripe SDK was not loaded by s2Member.

That would happen if another plugin used the Stripe namespace, then s2 will assume that the SDK was already loaded and count on it. If that other plugin used the Stripe namespace without loading the SDK, or loading an incomplete SDK, that would could cause the problem you got.

:slight_smile:

Ahhh…I had thought the stripe directory was a S2member directory…from your comment I see that this is the Stripe SDK, I should have realised that :slight_smile:

I ran into this type of collision previously between S2member, W3TC, and some in-house code in functions.php colliding over their independent loading of the AWS SDK. These are always interesting to try to sort out.

1 Like