Stripe API upgrade issues

We just created a new Stripe account for the client and it only lets you work with the latest API. I had to update the Stripeplan file according to these directions:
https://premium.wpmudev.org/forums/topic/membership-2-pro-giving-400-error-in-stripe-log#post-1303105

But, getting anomalies, and could notice the following in the debug logs, when a transactions are processed:

PHP Notice: Object of class MS_Model_Invoice could not be converted to int in /xxxxwp-content/plugins/membership/app/core/class-ms-factory.php on line 107

[16-Mar-2018 23:37:46 UTC] **************************** REQUEST START ****************************
[16-Mar-2018 23:37:46 UTC] ***** URL: http://xxxxx/ms-web-hook/stripeplan
[16-Mar-2018 23:37:46 UTC] MS_Gateway_Stripeplan[503]: Stripe error webhook: Please ensure that the <span class="ms-bold">Username</span> information is completed.<br/>Please ensure that the <span class="ms-bold">Email address</span> information is completed.<br/>Please ensure that the <span class="ms-bold">Password</span> information is completed.<br/>Please ensure that the <span class="ms-bold">Password confirmation</span> information is completed.<br/>The username is not valid, sorry.<br/>The email address is not valid, sorry.<br/><strong>ERROR</strong>: Domain not allowed.

Wasn't able to replicate the above logs again, now could notice the following when a new member is registered:

[17-Mar-2018 03:36:11 UTC] Stripe Notice: Undefined property of Stripe_Plan instance: name

Please check the chat notes for more info.

  • Kasia Swiderska

    Hello David,

    I have tested your site and right now seems that Stripe gateways works correctly on site after applying fix from other thread. I created user, paid for membership in Stripe and my account was activated.
    In debug.log only thing is this line:

    [17-Mar-2018 21:08:41 UTC] Stripe Notice: Undefined property of Stripe_Plan instance: name

    I have replicated the same issue on my site too, so I will notify developer about that notice.

    But other than that I don't see any issues with payments and account.

    I'm not able to replicate this original error on your site and not on my test one - this is how I performed test: in incognito mode I registered to site, I selected paid plan and then made payment in Stripe.
    Is there step I'm missing to replicate this first issue? Let me know.

    kind regards,
    Kasia

  • David @ BBS

    Cze?? Kasia!

    (I'll stick to English in case other users in the future happen to have the same issues so that they can easily follow this thread).

    Thanks for creating the test users! Glad the payments went through correctly. Happy to report that they also processed correctly on Stripe.

    In the logs I'm currently seeing this:

    [17-Mar-2018 21:08:41 UTC] Stripe Notice: Undefined property of Stripe_Plan instance: name
    [17-Mar-2018 23:41:24 UTC] PHP Notice:  Object of class MS_Model_Invoice could not be converted to int in xxxxx/wp-content/plugins/membership/app/core/class-ms-factory.php on line 107
    [17-Mar-2018 23:41:25 UTC] **************************** REQUEST START ****************************
    [17-Mar-2018 23:41:25 UTC] ***** URL: xxxxx/ms-web-hook/stripeplan
    [17-Mar-2018 23:41:25 UTC] MS_Gateway_Stripeplan[503]: Stripe error webhook: Please ensure that the <span class="ms-bold">Username</span> information is completed.<br/>Please ensure that the <span class="ms-bold">Email address</span> information is completed.<br/>Please ensure that the <span class="ms-bold">Password</span> information is completed.<br/>Please ensure that the <span class="ms-bold">Password confirmation</span> information is completed.<br/>The username is not valid, sorry.<br/>The email address is not valid, sorry.
    [18-Mar-2018 02:50:13 UTC] PHP Notice:  Trying to get property of non-object in xxxxx/wp-includes/script-loader.php on line 1239
    [18-Mar-2018 02:51:26 UTC] PHP Notice:  Trying to get property of non-object in xxxxx/wp-includes/script-loader.php on line 1239

    I don't know where this get's created. Wonder if it's also on subscription renewals?...

    Out of curiosity did you (or one of your colleagues) change the membership status for account web@b... ? Yesterday we had set his membership to expire to test a secondary issue relating to the fact that users retain access to all protected content after a membership is cancelled. (A ticket opened here: https://premium.wpmudev.org/forums/topic/canceled-membership-access-issue ) Oddly, the membership status for that user has changed from Cancelled to Active, and it was charged on Stripe. So curious if you're testing that. If not, then that means there's a bigger issue happening.

  • Nithin

    Hello David @ BBS,##1

    Hope you are doing doing good today. :slight_smile:

    Thanks for providing further observation regarding this. I made further test my local server, to see whether I could replicate such instance, but I'm not able to replicate the same log as reported in your site.

    However, I could still notice that the logs are still getting generated in your website. I'm escalating this issue to our Second Level Support(SLS) team, so that they could give a close look regarding this, and see if they have any suggestions regarding what could done to fix this within the plugin.

    Out of curiosity did you (or one of your colleagues) change the membership status for account web@b... ? Yesterday we had set his membership to expire to test a secondary issue relating to the fact that users retain access to all protected content after a membership is cancelled

    We haven't made any particularly changes regarding membership status, nor I don't see any update from our staffs making any such changes within your system. Are you able to notice the issue happening again in your system with other members, or replicate again?

    I checked the mentioned member, and could notice that the mentioned account have a status marked as billed at the moment, it doesn't have an active status at the moment. Invoice is marked as Billed when the payment hasn't been made by the user yet. It seems to be a recurring payment, and the the last successful transaction is pointing to the date 13th of March, could notice a transaction on 25th March, but it doesn't seem to mark the transaction as successfully.

    I'll also bring this into our SLS teams attention, so that they could give a closer look regarding this, and check whether it's related. Please do note that SLS developers work round the clock with many critical issues, and hence have a slow response time. Either myself, or the developer will keep you posted asap. We truly appreciate your patience regarding this.

    Have a nice day ahead. :slight_smile:

    Best Regards,
    Nithin

  • David @ BBS

    Hi Nithin,

    I'm testing with two users. Previously when cancelling the membership for user web@b... the membership was marked as being cancelled (and active till end of current subscription), but at the end it never expired and kept billing and showed as being fully active again on the test site. Which is definitely concerning if memberships don't cancel properly. Retesting with two members right now. Will have results tomorrow and will update you here.

    As for the logs, there is so much going on. Please take a look.
    Particularly:
    Stripe Notice: Undefined property of Stripe_Plan instance: name which happens when signing up for a membership.
    And dozens of MS_Gateway_Stripeplan[503]: Stripe error webhook: errors. Please take a look at the debug log.

    I'm actually convinced that the majority of these issues have to do with the fact that you're using an outdated version of the Stripe PHP library: version 1.16.0 released 2014-06-17!
    There have been dozens of releases since. Many involve how the library communicates with the newer API's. The current version of the library is 6.4.2. https://github.com/stripe/stripe-php

  • David @ BBS

    Ok, so did two sets of tests. In the first test, I canceled the recurring Stripe subscription membership for both test users, (did it logged in as the user from the front-end, so as if the user had cancelled their own subscription).

    The Good News:
    The subscriptions were correctly canceled on Stripe and no more charges were made after.

    The Bad News:
    Although Membership 2 plugin shows the members as having canceled their memberships. And Each member can see that on their account. However they still retain FULL access to all restricted content that they gained access to while the subscription was active. What's fascinating is that going under "/account/edit-membership" (aka, following the Change membership button), the first thing the member still sees is:
    The membership that was cancelled with a message: "Membership canceled, valid until it expires on March 29, 2018" along with a "Renew" button. Today is March 30th, 2018. So clearly the membership doesn't expire correctly.

    I then ran another test which was to subscribe to a Stripe membership (recurring 1 day in length). I then instantly canceled it. It properly canceled on Stripe again and in "Edit Membership" on our site showed me that the membership was canceled and would remain active till the following day, along with the option to Renew. So I renewed it. Two days later, the membership is marked as Active on our site. User has full access to restricted content. HOWEVER not a single payment has been processed via Stripe. Looking through the API docs looks like reactivating subscriptions doesn't require a lot of parameters, yet it looks like what the Membership plugin sends in the API request is a lot of data, none of which actually processes a reactivation of the membership, instead it registers as a "new default payment source changed" action.

  • Ari

    Hey David @ BBS

    Hope you are fine!

    We have released new version of Membership Pro 1.1.3, Please update the plugin to new version.
    Then for each paid membership you have to do the following task:

    1: Go to Dashboard -> Memberships
    2: Edit the membership, Go to Payment options
    3: Change the Payment amount to any temporary amount.
    4: Then again change the Payment amount to real one.
    5: Now check if this membership working fine!

    === What you did in the above task? ===

    Since stripe released new API, they changed the stripe plan code structure, so when we call stripe new API with our old code, it couldn't match and the plan get not created, so after upgraded our plugin where we added the new code here, you have to recall the stripe API so the plan get created. That's why we have to temporary change the payment amount, by changing the amount the stripe API get called with new code.

    Please follow these instruction for each membership you have, and let me know if that work fine from your end.

    Regards,
    Ari

  • David @ BBS

    Ok. So good news and bad news.

    Good News: looks like for the most part things ALMOST canceled correctly this time.

    Bad News: Let me explain the "ALMOST" part. Both test users were set to expire/cancel on April 6th. Today is April 7th. Unfortunately after logging into the two test user accounts, both still had full access to all restricted content. Checking their Membership status, one was marked as "Expired on April 6, 2018" and the other said "Membership canceled, valid until it expires on April 6, 2018". Again, today is April 7th, so both of those memberships should have updated as being expired/canceled. They were not. They still had full access. I had to login as an admin and manually run the Check Membership Status cron from the bottom of the Settings page. Only then did each member's membership status's get updated to expired/canceled. This is clearly problematic as the users had extended access to the protected content on the site.

    If my understanding is correct, since the site hadn't been accessed in 48h, cron wasn't run. Which is fine. However cron should have run the first time the site was accessed. So when I logged in as my "Barbra" test user, cron should have run, checked that her membership had expired and marked her membership and protected content access accordingly. However cron didn't run on that first access. Nor did it run for the next 20 minutes. The settings page was showing cron would run in over 5h.

    I understand the reasoning behind checking membership status's every 6hours (which is the cron frequency for this task). However, can you please explain why this cron task doesn't run right away if it was missed?

    Thanks.
    David

  • Kasia Swiderska

    Hello David,

    I have pinged developer in second thread where there is task about cancellation assigned and send update you have posted here. I will send direct message to developer now about your latest findings, but please try to post them in original thread https://premium.wpmudev.org/forums/topic/canceled-membership-access-issue so developer won't need to jump here. We try to keep issues separated to avoid any confusion.

    Developer will respond as soon they will find solution for the issue.

    kind regards,
    Kasia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.