Creating invoices, changing the dates of payment and marking invoices as paid

The Membership is creating invoices by itself and changing the dates of payment
marking invoices as paid when those are not.
I have this invoice, but I don't know when the user paid. It is not linked to a gateway and I can't find the transaction.
I'm also receiving from IPN (PayPal) a lot of: 'Duplicate: Already processed that transaction'

  • Daniel

    I come here AGAIN ask for your help, because this is not working properly yet.

    The system is creating invoices for the user just registered and then creates invoices also for the next coming months as marking these as paid.

    Anotherthing that happened is that these new invoices are trying to charge when created, the transaction log returns this: 'Duplicate: Already processed that transaction. [Irrelevant IPN call]' (check attachment)

    For now I'm trying to survive this problem, but is not easy. I don't know anymore what members have paid and have not.

  • Lindeni Mahlalela

    Hello Daniel

    I hope you are doing great today. I am sorry for the delayed response from our side regarding this issue. I have checked your website yesterday and today also to try and figure out the issues reported here. Let us go through this together and try to find a solution.

    Duplicate: Already processed that transaction

    Even though I am not sure what causes this on Membership Pro but I found on some forums that this could be caused by a situation where PayPal sends an IPN call to a website and the website returns an error like 500 (Server Error), this triggers PayPal to think that there was an error on the IPN url that means the transaction was not logged in the receiving website, so PayPal has to send the IPN request again. The issue is thay if this is the case, the request will be marked as duplicate because it previously ran succesfully on PayPal but failed on your website.

    I found this thread may be very useful in debugging this issue, basically what is suggests is to check the IPN logs and server logs to see if any errors were encountered during an IPN call. I checked the IPN logs in Membership Pro on your website and found that those transactions with the log entry "Duplicate: Already processed that transaction. [Irrelevant IPN call]" have already been paid and as the log message says "Irrelevant IPN call" it means this can be totally ignored and it is only a warning not a serious error.

    I am sure that this is due to a temporal error on your website, it may be due to resource limit, that caused the server to fail to respond to PayPal's IPN call and PayPal had to retry the call. You really should not worry about this as the transactions seem to be logged correctly on the first attempt. Just to be sure, I suggest you also check your server's error logs to find out what errors are related to IPN calls.

    I also noticed that when I'm editing the invoice or user details, it takes too much time to load the page, and returns some errors (query monitor)

    In the screenshot you shared, it looks like the error is due to a timeout error related to SmartCrawl plugin. This might be because SmartCrawl was processing something and it timed out. To solve this you may want to increase the timeout limits on your website by adding doing one of the following:

    a. Add the line to php.ini or .user.ini file in the root of your WordPress install like public_html/php.ini or /.user.ini:
    max_execution_time = 300

    b. If it does not work with php.ini/.user.ini you should try adding the following line in .htaccess file located on the root of your WordPress install:
    php_value max_execution_time 300

    c. If both the above do not work try the following in wp-config.php file:
    @ini_set('max_execution_time', 300);

    300 is the time in seconds the script is allowed to execute, you may like to increase or decrease depending on your setup but 150 is the recommended minimum in most plugins.

    I had an invoices (billed) so I marked that as denied, then the plugin created 8 new invoices (marked as paid) for the user. He didn't paid for membership.

    If the invoices are billed, I wonder why you mark them as denied. Is there a specific reason for this? Do you intend to cancel them all together or trying to achieve something else. I ask this because usually, Membership Pro will generate invoices for all recurring subscriptions and wait for PayPal's (or any gateway used) to send IPN request so that Membership Pro will mark the invoices as paid/ not paid and update the subscription as required. Would you please elaborate as to why you mark the invoices as denied.

    Anotherthing that happened is that these new invoices are trying to charge when created, the transaction log returns this: 'Duplicate: Already processed that transaction. [Irrelevant IPN call]' (check attachment)

    As explained above, this is for already paid invoices and should only happen once on the relevant billing date or a few days after for retries if the payment failed. Please double check if the invoices receiving this error are truly not due for payment. If it is renewal time for recurring subscription then they should be charged, and retries will be made if the payment has failed.

    I hope to here back from you soon with answers to the questions I asked, I know you are very busy but I need more information to understand what's going on here. I hope we resolve this soon.

    Have a nice day.
    Lindeni

  • Daniel

    About this

    max_execution_time = 300

    I've already done this. But the major problem seems to come up only when I save or edit an subscription or an invoice, so I now for a fact the problem is on Membership.

    You've said that wonder why I'd mark an invoice as denied. At first I didn't do that, cuz I just wanted to reduce the notification number on menu, just to make sure I was up to date on the invoices, so I was removing them. That also generated a problem, so I started to mark as denied.

    But I'm sure marking an invoice as denied shouldn't be a problem or generate a secondeary problem, even I'm not managing it right.

  • Lindeni Mahlalela

    Hello Daniel

    I hope you are doing great today. Thank you so much for the response and feedback, it is highly appreciated.

    I have tried today to create a new Membership, a new Subscription and along with an invoice for the subscription, everything went smoothly but I can say it took much longer than usual to save in all the processes but I did not get to a timeout situation. I checked my email and got One user account confirmation, One subscription confirmation and one invoice and checked the dashboard and found only one paid invoice.

    Now I am not sure if I am missing anything here so please show me some screenshots so that I can see where you experience the issue and how to reproduce it. It will really help if you can record your screen as you go along with this, a screen recording will help me see what happens and what error messages you are getting.

    I am really sorry that this is not resolved so far so please give as much information as possible and share screen recording or screenshop where possible. I am waiting for your feedback.

    Have a nice day.
    Lindeni

  • Lindeni Mahlalela

    Hello Daniel

    I hope you are doing great today, thank you for your feedback.

    The screenshots are above on previous posts.

    I have seen those screenshots and discussed why those issues occur, the error in query monitor is was a timeout related to SmartCrawl and it is not permanent error, if it occurs again you can solve it by adjusting the "max_execution_time" as detailed above. The "Duplicate: Already processed that transaction." occurs because of duplicate IPN requests for an already paid invoice, so this should not be worrying you unless the invoices marked as duplicate are actually not paid.

    I requested screenshots or references for this situation:

    The Membership is creating invoices by itself and changing the dates of payment
    marking invoices as paid when those are not.

    I noticed you shared one link already but it seems to just redirect me to the home page so I could not see an invoice with this issue, so please share an invoice ID or direct link to such invoice(s) (duplicate, marked paid but not actually paid, created as draft but too early) so I can have a reference for this issue that will help me understand and or replicate the issue easier.

    Could you also mention which payment gateway is having these issues, that will help as well.

    Have a nice day.
    Lindeni

  • Daniel

    All right, I think I'm not being clear.

    I'm not sure when the error happens! The system is creating automatically many invoices to the same user. Somtimes it happens when I delete/archive an invoice or when I edit a subscription.
    Most of the times it happens when the invoice uses the gateway Standard PayPal from the Membership 2 Pro core.

    Just now I was cheking the invoices, and saw it created another invoice for an user just paid. Check the attachment.

    CHeck also the attachment 2.jpg, that show a new user just paid. It auto created another invoice marked as billed with the number 3, when it should be 2.

  • Lindeni Mahlalela

    Hello Daniel

    I hope you are doing great today. Thank you for your feedback and for your patience so far. Now I see what you mean, thanks for showing this on the last screenshot.

    There was also another related issue where an additional invoice was created for the same user after payment when using PayPal Standard gateway which seems to be active on your website. It was solved by applying a fix on the PayPal Standard Gateway files, fix provided on this thread. I have applied the fix by uploading the provided file into your website, if the issue is directly related then it should go away after applying the fix, so please do a couple more tests and let us know how it goes.

    If the issue is not fixed, just let us know and we will continue troubleshooting.

    Have a nice day.
    Lindeni.

  • Daniel

    Again I'm here to talk about this error.
    I'm testing it on staging site: removing, addind, editing, etc.

    For now, the major problem I found was on Smartcrawl messing with the Membership 2 Pro.
    Well it's like that, whenever when I edit or remove an invoice or edit an subscription it takes forever to load, sometimes more than a minute and returns an error from Smartcrawl (check the attachment 2.png).
    When editing the invoice I noticed it returns the error only when I check "
    Execute status change actions on Save (add/remove membership)" (see attachment 1.png).

    I also tested deactivating Smartcrawl and it doesn't return the errors.

    I've set the memory limit to 128MB

    I didn't try the fix that you mentioned in last reply, I'll do ASAP.

    Still didn't get to simulate the other error that creates more invoices.

  • Lindeni Mahlalela

    Hello Daniel

    Thank you for the feedback and sorry for any issues you are experiencing so far. Would you please raise the memory limit to at least 256Mb but even more if you can. WordPress in general recommends 256Mb for the WordPress admin and so do most of our heavy plugins.

    You can simply add this line in your wp-config.php file to raise memory for WordPress admin:

    define("WP_MAX_MEMORY_LIMIT", "256M");

    I strongly recommend you set it higher than this if your host can allow it. The error shown in the 2.PNG screenshot is the one referenced by Query Monitor in the screenshot you shared earlier, basicall what this means is that once PHP runs into Memory issues, the page will just hang there and not get a response from the PHP script and so will result in a timeout. In this case, it doesn't matter how big the timeout limit is, it will always timeout if it runs into the memory issue again.

    Please raise the memory and do the test again,.

    Have a nice day.
    Lindeni.

  • Daniel

    As you can see I'm really trying. I've install the fix you've mentioned and increased the memory limit to 256MB.

    My first test was edit an invoice. It was billed, I just opened and saved, with the "Execute status change actions on Save" checked, I didn't change any data. As you can see in attachment 2.jpg it saved the invoice (circled invoice) - ok, but created other 14 invoices for the user marked as paid AND assigned the membership to that user.
    This is the MAIN error that I mentioned before when I opened the thread.

    Just to make sure I increased the memory limit to 512MB and tried to remove the 14 extra invoices and then returned the same error of 2.png from the last post: (https://premium.wpmudev.org/forums/topic/creating-invoices-changing-the-dates-of-payment-and-marking-invoices-as-paid#post-1318018)
    It even remove some invoices, but not all of them.

    I deactivated the SmartCrawl and did some tests again. Gone everything fine! No error and it was fast.
    Turned it on Back did the same tests. This time didn't generated new invoices, but the loading time is reaching 2 minutes, with no errors. I'm cheking error_log file, but nothing seems to show.

  • Daniel

    Hey my friends, I'm really disappointed with the support, cuz it's taking too long to be solved.

    I'm forced to disable Smartcrawl and install Yoast SEO, despite I find Smartcrawl better, it's blocking the navigation as I said on previous replies.

    I required the support tem to solve this last month and nothing was done yet! I'm having a serious problem with it. I'm already thinking leave WPMU DEV because of this.

  • Lindeni Mahlalela

    Hello Daniel

    I am sorry for the delayed response from our side, I have been trying to figure this out and I am collaborating with my colleagues to solve this.

    I have noticed that most of the duplicate invoices are linked to the Bitcoins / Altcoins (Go Url) payment gateway installed on your system. Unfortunately we cannot support this as it is custom work, you should contact the developer or check it if you created it yourself. On the code for the custom gateway it should get the current invoice, check its status and update it if necessary instead of creating a new one. It should do this as soon as possible to avoid unnecessarily changing the current invoice or creating new ones.

    There was a previously reported issue with regards to the duplicate invoices but that was for PayPal Standard and it was generating only one additional invoice. So I have applied the fix for the PayPal Standard gateway now you should contact the developer of the Bitcoins / Altcoins (Go Url) to check and fix their code. Unfortunately, there is nothing much we can do for third party plugins.

    With regards to SmartCrawl slowing down the website, I am still waiting for the senior developer of SmartCrawl to give me more information as to why it causes that. What I have now is that SmartCrawl may be doing analytics on that page and that could be slowing it down, I also saw intermittent timed out requests to our API for the Dashboard plugin, this could be related but we still have to double check and have facts as to what is actually happening. Once I have the information I will see what I can do and either me or the developer will prepare a fix and update here when done.

    For now please look into contacting the Bitcoins / Altcoins (Go Url) plugin developer to see if they can help, please let us know what they say. We will be looking into why SmartCrawl slows down the Membership 2 pages and we will update here once done.

    I hope to here from you soon.

    Have a nice day.
    Lindeni

  • Lindeni Mahlalela

    Hello Daniel

    I forgot to mention that the duplicate invoices I saw today suddenly disappeared while I was checking things out. Did you or anyone working with you manually deleted them? If no then it means Membership 2 plugins automatically removed them. I know it generates Drafts for when the next billing cycle is close and then change the status of these drafts when something changes on the user's subscription. The custom gateway should consider this and set the new invoices as draft and check them when receiving IPN calls and update according to the information received from IPN.

    I hope this helps. Please let us know if there is anything else we should know.

    Have a nice day.
    Lindeni

  • Daniel

    So?

    I've tried everything again! it's been almost a month since I started this thread. Didn't seen any thing on any of the problems.

    I had to switch to Yoast SEO to use the admin area, the Smartcrawl was slowing down the website when working with Membership 2 Pro.

    Already tried to deactivate all plugins but Membership 2 Pro and Smartcrawl and user the Wordpress Default Theme, but the problem still happens.

    I NEED this solved!

  • Nithin

    Hi Daniel,

    Sorry for the delay in getting back to you, since you have confirmed the issue still exists even when the custom gateway is disabled, and with deactivating other plugins. I'm bringing this into our SLS teams attention, and checking regarding the status of the issue in their side. Either myself or the developer, will keep you updated via the support ticket regarding what exact could be causing this asap.

    We truly appreciate your patience regarding this. :slight_smile:

    Regards,
    Nithin

  • Panos

    Hi Daniel !

    So sorry for missing this task and leaving it hanging.

    I had a look through the invoices but I don't see any duplicate invoices. So I assume they have been Archived (Removed) as the ones of user tung which are in the screenshot of a previous reply.

    Regarding those, the gateway seemed to be Manual and then there were many of them set to admin. You have mentioned above that this happened to another member that subscribed using the Manual gateway.

    Wasn't able to replicate this on a staging site I found on your server, nor in my testing sites. I'd like to register a few test members on your live site using the Manual gateway, but I'd need your permission before I go on. Please let me know if you're OK with this.

    Kind regards!

  • Panos

    Hey there Daniel ,

    There have been some fixes in plugin codebase and there is a beta ready.

    I tried replicating this on your site, with existing version, but invoices were set correctly. I tested with my sandbox account and I had to switch the currency to USD for a few minutes in order to test with PayPal, as it doesn't accept BRL.

    Although I couldn't replicate the issue, I think it would be worth installing the beta version to see if you can still have this issue.

    Please let me know if you agree to this :slight_smile:

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.