Stripe - multiple trial installments

Thanks for the update.

Are you able to reproduce this in a clean WP with an uncustomized s2Member? Let me know if you can reproduce it in a normal installation.

If you can’t, then it’s not a bug in the plugin, and it’s something in your hack that you need to troubleshoot, I think.

Just to back track on this a bit… When I started down this path, in the beginning, I was getting the “…your membership has been approved…” type message. That is when I got into trying to set the “success” parameter as I was exploring different combinations. Something between then and the latter “test and settings” got me to the “…email already in use…” error which through everything off track.

So you were fine until some change you made to the customization, when you started getting the error, right? Well, you could go back to the earlier versions and compare what changed?

Hi Christian,

I thought I had said this earlier…but

I’m now testing on a clean UNCUSTOMIZED version. I had expected it to go back to working but it did not. That is the current mystery.

I had documented every change I had made originally so I went back and confirmed that I changed all those settings back. The only settings that remains are:

define(‘MEMBERSHIP_LEVELS’, 2);

…that I had added to the wp-config.php file…

and the Stripe Test and Secret Keys (need those to do any tests)

So…??? Anyway, added some logging to the code and this is the calling chain (stripped out the log pre-entries to simplify it and make it readable)

LOG ENTRY: Thu Feb 28th, 2019 @ precisely 12:41 am UTC
PHP v7.0.6 :: WordPress v5.0.3 :: s2Member v170722 :: s2Member Pro v170722
Memory 22.26 MB :: Real Memory 2.00 MB :: Peak Memory 22.30 MB :: Real Peak Memory 2.00 MB
test.peer-pods.com/proform-test/
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15

stripe_checkout - line 76 - pre validation check

stripe_form_submission_validation_errors

stripe_checkout - line 76 - pre validation check

stripe_form_submission_validation_errors

Email exists - checkout

…as you can see it calls the checkout, validates, then loops around and recalls the checkout which then fails because the first call added the user. Without digging any deeper this seems unlikely that any standard settings I could have made would trigger this without it being a bug.

Any ideas what could be causing it to loop back and re-call the checkout code???

Well, here is the status on this…

I did finally get a clean install in which the basic proform would work. The problem is that I have a website that has had so much work and development on it that it will be prohibitive to re-develop it from scratch.

I did spent some more time on the first test version so see if I could track down what went wrong. This is the version in which all of the plugins were deactivated except for s2member.

What I did find, I think conclusively is that the do_action(‘init’, ‘c_ws_plugin__s2member_pro_stripe_checkout::stripe_checkout’) for the post was being called twice. I used a backtrace to see that there were two calls to that function.

Why I still don’t know. I did find a post on Stackoverflow that suggested that any 404 for a resource on a Wpress page will cause the ‘init’ to be recalled. Problem is that in watching the network traffic from the browser there were no 404s, only 200 and 304 (cache). So dead end there as best that I can see.

(I have the outputs for all of this is someone wants to see it)

Now my problem is to slowly add plugins to this clean site and see what breaks it…

I don’t want to even imagine how many hours this is taking… Aaaarrrrgggg…

If you have any other thoughts… I’m all ears!!

1 Like

Oh, the fun. I can’t say I envy you. I understand the process you’re going through.

Well done for going back to a clean installation. Now adding the plugins will help you locate where the issue may be.

I’d start with the ones from someone else, and then add the hacks you created.

You can do batches, not just one by one. If the problem comes back after a batch, then break it down to narrow down to one. But batches are a faster approach. Sometimes you add half of the plugins and the problem doesn’t come back, you just saved a ton of time.

This plugin helps you do that, if I’m not mistaken: https://wordpress.org/plugins/plugin-detective/

Keep me updated. I look forward to what you find. :slight_smile:

Hi Cristian,

After creating the new basic Wpress install and only adding the s2member framework and pro, I started adding plugins.

Found the one… it is Wordfence. What is interesting is two things: 1) When I originally started this part of the project, the basic proform was working fine and Wordfence was active, it appeared to suddenly stop working one day. My assumption is that I did an update of that plugin and that introduced the issue. 2) that it does not have to be active. Its very existence causes the problem. I searched for that type of issue, (i.e. deactivated plugins causing compatibility problems) and did not find anything… So Is this unusual??

It was my assumption, clearly wrong in this case, that deactivating it brought it out of play. Well, in the case of Wordfence, not so!! Well, I’ll come back to that issue later.

What I did find though, concerns me long term, as far as stability of the basic s2member subscription process. What I mean is that any 404 or other failed resource would/could trigger a re-firing of the “init” functions on that page. It seems that the dependency of using the “init” to fire the checkout code is risky (and not something that is easy to discover) and is not something even you suspected (which leads me to suspect that this technique is not common knowledge??). It appears that Wordfence does something during its install that triggers this re-call of the page because it is clear from my research that this is exactly what was happening.

Here is the link I found that matches the data I collected… (Though note, that in tracking the network traffic, the browser did not detect any 404 errors, therefore it may be something Wordfence is doing locally on the server. The effect appears to be the same regardless.)

If you could pass this issue on to the programmers, maybe they can set a flag that detects this condition.

Now I need to get back to the original issue of this thread, and how to work around those issues… Good thing I enjoy mysteries…

1 Like

Nice detective work! :slight_smile:

I’ve seen some plugins that even disabled, may still affect some change, usually when they add a must-use plugin.

And thanks for the heads-up. :+1:

I’ve gotten back to the original goal and that was to have two recurring subscriptions. I had originally hope to have multiple trial installments with a regular subscription, but that was not possible, so the second possibility (reviewing the beginning of this thread) was to have two CONCURRENT subscriptions. One for 3 months and the other ongoing until canceled.

My first stab at this today was encouraging but I ran into a hiccup… That is, the second subscription CANCELS the first subscription. I thought this was a Stripe issue but doing research on that indicates that as of 2014 multiple subscriptions are allowed:

So… I’m assuming then, that the issue is within s2member… The only thing I had not tried is to set the trial period on the second subscription to 3 months so that it starts after the first is complete. So, I tried that… No Joy…

I did set the “modify” setting to 0 after several tries and that had no effect. My read of that attribute was that it allows for additional subscriptions…???

So… what am I missing?? It appears that is should be allowed but, so far, I have not been able to get it to work. The first subscription always gets cancelled.

Sooo near, yet so far…

Any suggestions???

Did more testing this afternoon and encountered something that is troubling. Aside from the concurrent subscription issue at least the general process works. WHEN THERE ARE NO OTHER PLUGINS INSTALLED.

But… I then started to add just ONE plugin… in this case a required SMTP mailer and that triggered the previous problem of the loopback/init double checkout previously described above. So, it is not JUST Wordfence… I have not tried others yet and will next, but this is a very troubling trend…

Yeah, you are trying something so custom, that you hit some limits of the current integration.

s2Member doesn’t handle more than one subscription at the same time. In the user profile you’ll see there’s only one field for the subscription. No multiple concurrent subscriptions. I thought you knew this or that we had mentioned it, but I guess not.

You customization, to have two concurrent subscriptions, would need to have one of them managed by your hack, outside of s2Member. Or you’d need to modify s2Member to be able to handle more subscriptions. I think the former one is simpler.

The 1st subscription create it normally with s2, not the 2nd one, though.

To create the 2nd subscription, look at how s2 does it, so that it later will work with s2, but don’t have s2 create it or it’ll replace the 1st one, as you saw.

You could save the 2nd subscription’s info in a usermeta entry, and on EOT of the 1st subscription, have your hack update the user’s profile with the 2nd subscription’s info, or end the 2nd subscription over at Stripe if he didn’t complete the 1st one.

Does that help?

Yeah, that helps… (put the nail in that coffin…)

Seriously, I think what I will do, or try next, is create the first subscription and using ccaps flag it as the training subscript. Then, when the system drops that user back to level 0 upon EOT then have code that looks a the state of a level 0 with that ccap flag, then direct the user to the membership subscription page. Once they complete that subscript, update the ccap flag as well.

Of course, it goes without saying that there is the feature request of multiple subscriptions…

Now the next issue…

I need to do some more testing but as I indicated in a previous post here, it’s getting kind of scary that another plugin breaks the s2m Stripe Profom. The duplicate checkout with the do_action(‘init’,…) is showing up far too often… With Wordfence it made some sense because Wordfence is so intrusive to the whole system (and for good reason), but an SMTP mailer… that is hard to explain…???

Any thoughts??

Absolutely. This one is already in my list, high. :+1:[quote=“jbmoore, post:31, topic:5606”]
. The duplicate checkout with the do_action(‘init’,…) is showing up far too often…
[/quote]

In a normal installation, or with your customization?

Can you reproduce the problem with a clean WP, s2 and just that other plugin? I’m curious about that, because I thought you only had that happen with your customized installation.

Don’t quite know what you mean here. The only customizations are to the Proform shortcode and that is to add the “success” attribute. As follows:

[s2Member-Pro-Stripe-Form level=“1” ccaps=“paid_training_installmt” desc="$120.00 USD / 3 Training Fee Installments" cc=“USD” custom=“dev2.peer-pods.com” ta=“0” tp=“0” tt=“D” ra=“120.00” rp=“2” rt=“M” rr=“1” rtt=“2” coupon="" accept_coupons=“0” default_country_code=“US” captcha=“0” modify=“0” success=“http://dev2.peer-pods.com/membership-subscription/” /]

Everything else is at default and ONLY s2member installed and active.

Yes, that is what I’m testing right now… It works fine with NO plugins, but when I add just one plugin I’m getting the double checkout with the “…That Email Address is already in use. Please try again…” error.

I have tested two SMTP plugins…

(Note: the reason I need an SMTP plugin is because for security reasons I have SendMail disabled (I use Atomic Secured Linux for the firewall and all other server security) Therefore I can’t use the default mail() function.)

Tested Plugins

Easy WP SMTP
WP Mail SMTP plugin

(Note: I’ve used the Easy SMTP plugin for many years with no issues)

Here is the test process I used…

  1. Setup (In Firefox)
    a) Remove all users (except Admin user)
    b) Clear all test users from Stripe
    c) Log out of WP Admin
    b) close if open and re-load fresh Safari
    d) Clear all history and cookies
  2. Begin Test (in Safari)
    a) Paste test page http://dev2.peer-pods.com/training-fee/
    b) fill in fields and Add Billing Method using test card 4242424242424242
    e) Submit

The tests…

  1. Run #1 and #2 with no active plugin besides s2m
  2. Works fine
  3. Active one SMTP plugin, configure and run test email
  4. Run #1 and #2 – Failed with error
  5. Deactivate plugin
  6. Run #1 and #2 with no active plugin besides s2m
  7. Works fine
  8. Active another SMTP plugin, configure and run test email
  9. Run #1 and #2 – Failed with error
  10. Deactivate plugin
  11. Run #1 and #2 with no active plugin besides s2m
  12. Works fine

Note that I always follow this exact process for each test run…

What are the odds that two mail plugins would trash s2memeber the exact same way…??

I’ll be glad to give you access to the test site…

1 Like

Thanks for the detailed answer.

We’ve used SMTP plugins over the years without problems (e.g. WP Mail SMTP with AWS), so I’m not sure why it’s giving you trouble there. I’m curious and would like to find out.

Yes, I’d like access to the test site to look at it. Message me privately for this.

:slight_smile:

You and me both…

Sent via PM…

1 Like

Got it. Thanks.

I see that you have a must-use plugin for auto-login. Did you remove this as part of your tests when adding the SMTP plugin?

Ah, you know I didn’t, because I need that to make what I was testing work…

I’ll do a quick test without it…

1 Like

Sadly, no joy…

I completely removed the mu-plugin (directory is now empty).

Then did the test sequence twice, just to make sure… Same error

That Email Address is already in use. Please try again.

I’ll be out of the office for a few hours so I’ll test test this again just to make sure… For now the auto-login plugin has been removed.

1 Like

Got it. Thanks for the update.

Hi Cristian,

Did a bunch of testing this afternoon, but frustratingly the results were inconsistent, so it is hard to see much of a pattern…

Again for clarity is the prep for EACH test…

Here is the test process I used…

  1. Setup (In Firefox)
    a) Remove all users (except Admin user)
    b) Clear all test users from Stripe
    c) Log out of WP Admin
    b) close if open and re-load fresh Safari
    d) Clear all history and cookies

  2. Begin Test (in Safari)
    a) Paste test page http://dev2.peer-pods.com/stripe-proform-test/
    b) fill in fields and Add Billing Method using test card 4242424242424242
    c) Submit

(Note I created a NEW test Proform using ONLY the defaults.)

S2Member settings

—test mode
—Stripe Api keys
—Logging turned on
—Three levels defined
—Login page - no
—Membership Options page (set to a blank new page)

That is it - the rest are untouched

The Tests

#1 - No plugins

Email Address already in use

#2 - Repeat #1

Account approved

#3 - Activate Easy SMTP

Email Address already in use

#4 - Deactivate Easy SMTP

Account approved

#5 - Install and activate Classic Editor (The WP addon)

Email Address already in use

#6 - Repeat #5

Account approved

#7 - Repeat #5

Account approved

#8 - Different SMTP plugin with Classic Editor active

Email Address already in use

#9 - Repeat #8

Email Address already in use

#10 - Deactivate SMTP plugin (leave Classic active)

Account approved

#11 - Deactivate Classic - Install BuddyPress

Account approved

#12 - Deactivate BuddyPress - Install a new SMTP plugin (third one tested)

Email Address already in use

#13 - Repeat #12

Email Address already in use

Since I had logging on you can view the logs from this testing…

So… what does this all mean?? Definitely confusing. Some guesses… 1) It is interesting that #1 threw error with no plugins and the first go round with Classic also threw error. This suggests caching - which as far as I know does not exist. Because of that, I did do a number of repeats to test that… Again inconclusive.

I really do need an SMTP plugin so that is critical (which one is not)… Tomorrow I’ll test some of the other plugins this client required and post the results.

I would though appreciate any suggestions, issues you may see or changes I can make on the testing setup. FEEL FREE TO DO YOUR OWN TESTING… (is that hint or what ) and feel free to trash this test site in anyway you like.

1 Like

Nice tests battery.

After what you described, what comes to mind would be trying testing in a different server or hosting. Maybe there’s something in that environment that’s causing this weird behavior…