Pro sites expiry billing issues

Having issues with Pro sites billing. Member choose "Custom" level, and made a payment for "Custom" level, and then the user got a message that the level was "Custom Express", instead of "Custom" which is half the price.

After reviewing the users account in Stripe, could notice she has a credit of 187, and is on the "Custom Express" level, instead of "Custom".

The user did have a failed payment prior to make a payment, as her card had expired. Please check the chat transcript for more info.

  • Panos

    Hi there Ben!

    So sorry for such a delay here!

    I would like to have a closer look here if you still have this issue. Could you please send in admin and ftp credentials? You can send that privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    Send in:Subject: "Attn: Panos Lyrakis"

    - Admin login:
    Admin username
    Admin password
    Login url

    - FTP credentials
    host
    username
    password
    (and port if required)

    - link back to this thread for reference or any other information that may be required in order to have access.

    Kind regards!

  • Ben

    SO here is my latest failed billing from a person that was previously subscribed, then subscription has been cancelled, then she is trying to re-activate her blog with a new credit card. She goes to her account page, selects the package, enters in a coupon code: she then enters her payment, and hten she says it appears that after submitting her payment that nothing happened.

    Reviewing in my stripe.com dashboard:

    cus_XXXXXzzkk added a new Visa ending in 5XXX  03:09:22
    cus_E2QUn6mKV5zzkk is a new customer  03:09:22
    customeremail@gmail.com's details were updated  03:09:18

    SO...it looks like a new customer WAS created...but not payment was made.

    NOW reviewing the php logs I'm seeing...

    [25-Nov-2018 11:18:28 UTC] PHP Fatal error:  Uncaught InvalidArgumentException: You cannot set 'email'to an empty string. We interpret empty strings as NULL in requests. You may set obj->email = NULL to delete the property in /srv/users/main/apps/wordpress/public/wp-content/plugins/pro-sites/pro-sites-files/gateways/gateway-stripe-files/lib/Stripe/Object.php:54
    Stack trace:
    #0 /srv/users/main/apps/wordpress/public/wp-content/plugins/pro-sites/pro-sites-files/gateways/gateway-stripe.php(2142): Stripe_Object->__set('email', '')
    #1 /srv/users/main/apps/wordpress/public/wp-content/plugins/pro-sites/pro-sites-files/lib/ProSites/View/Front/Gateway.php(94): ProSites_Gateway_Stripe::process_checkout_form(Array, 0, false)
    #2 /srv/users/main/apps/wordpress/public/wp-content/plugins/pro-sites/pro-sites-files/lib/ProSites/View/Front/Checkout.php(103): ProSites_View_Front_Gateway::render_checkout(Array, '', false)
    #3 /srv/users/main/apps/wordpress/public/wp-includes/class-wp-hook.php(286): ProSites_View_Front_Checkout::render_checkout_ in /srv/users/main/apps/wordpress/public/wp-content/plugins/pro-sites/pro-sites-files/gateways/gateway-stripe-files/lib/Stripe/Object.php on line 54

    So people are really trying to use my product...but can't pay...so would really love you guys to fix your plugin and test it...perhaps on this scenario of expired blogs both who have been expired manually and via expired payment source..

    Perhaps also test against php 7.2 and 7.3 would be nice.

    This has been going on a long time...i only know about this latest one because the customer was nice enough to inform me.

    Joel James Panos Adam Czajczyk Predrag Dubajic

    Lets really get this stable....please.

  • Ben

    So now I'm reviewing the code lets look at line 2142 in the error statment i showed earlier

    $c->email = $email;

    So its saying this variable is not set with an email...and is instead just...empty?

    So perhaps some if statement needs to be set where if this is empty is checks to see what the blog admin email is for whatever the blog id is of this pro-site...and then use that? I haven't really worked through the logic of the code...but seems to be a bottle neck here.

  • Joel James

    Hey Ben,

    Really sorry for the delay and thank you for your patience.

    That error usually happens when the registration data from the session is cleared somehow. Because we are trying to get the email id using multiple methods (if one is not available, another one). Like you suggested, we are also trying to get the admin email address if blog id is available. But if the user account was logged out or the registration data is cleared during the payment, Pro Sites won't be able to get the email address. Can you check if that was the issue here?

    Currently, we are working on some improvements in Stripe gateway, and we will definitely look into this if we can avoid this issue in future.

    Regards,
    Joel

  • Ben

    Joel James

    But if the user account was logged out or the registration data is cleared during the payment, Pro Sites won't be able to get the email address. Can you check if that was the issue here?

    I'm pretty sure there is a logic fail...I've mentioned that this scenario is consistant with a billing source having expired longer than X days. I'm pretty sure the threshold is related to the time change in the February api change.

    So please...eliminate the idea that this issue is occurring from the user logging out. In addition, **just prior to the "email not there" fail, the user's payment source is updated to their existing stripe account, as shown in the logs. So I don't think the theory of why you think the fail is occurring makes sense **

    This is a bug. Please review the logic leading up to where you think you have the email address but its not being set and figure out why in this scenario.(scenario being the subscription has failed so many times that its been cancelled by stripe via and a new subscription (feb api change) for the expired blog id needs to be created (not updated) because of the amount of failed billing attempts)

    In addition, please do "if" statement to check if the "email" variable exists on the code line 2142 , and then if not, re-query the blog id for admin email address as a quick patch to this bug. I believe you do that attempt in another part of your code...but unfortunately that bit of logic is failing and not getting hit.

    That error usually happens when the registration data from the session is cleared somehow.

    I agree that could lead to this issue, but I am fairly certain you have another issue with the logic of what happens because this failure has been consistent with multiple clients. This instability I have been mentioning is very unnerving...lots of people credit cards expire at some point or get stolen causing subscription fails which then can trigger this issue.

  • Joel James

    Hey Ben,

    Yes, I understand the issue you are referring to. And we have added a fix for that which is already in QA (so the next version will be live soon). Pro Sites will now create a new subscription in Stripe if the existing one is cancelled in Stripe.

    And about the potential email issue, you have reported, we are currently working on improving the Stripe gateway and I hope we will be able to handle it in a better way from next version onwards.

    Regards,
    Joel

  • Ben

    okay..what about my suggestion about simply checking for an email and if its not there, grabbing one from the site id query...? Or surrounding this with a try/catch statment to stop the fatal fail which leaves people that are trying to pay money...hanging. Or are you saying its more than that as you weren't creating the new subscription before.

    Can I review what you guys are doing? Is there a time you estimate it to be released or can you pre-release a patch?

  • Ben

    Joel James

    After reviewing, seeing how what you said about how the email dissappearing later causes that issue, but is unrelated to the original issue i pointed out about it not creating the new subsciption.

    Currently,.... it his still broke. And say I have a customer who was previously paying 49, and I gave him a discount of $10 month...currently no way to give him that again.

    The billing source updates successfully, but if i re-activate the subscription in the wordpress admin area, it re-activates without the discount. So...don't forget to about that scenario as well.

    Looking forward to your release, its very confusing to people wanting to pay $$$.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.