robertb Posted October 15, 2014 Share Posted October 15, 2014 Hello All, I have had a custom module created so that I could integrate WHMCS with my system. Everything for initial orders is working properly. But, I need to make sure that the proper API call is triggered on successful renewal and then on failed renewal (which would be a suspension). On Settings > Automation Settings > Automatic Module Functions, I have set "Suspend Days" to 1 based on another thread I found in the forum. My understanding is that this will suspend the account right away if there renewal does not process successfully. The problem I have now is..... how do I test a successful and failed renewal? I was hoping that I could set the billing interval to "1 DAY" so that I can place an order today and it will renew tomorrow. But, I cannot seem to locate such an option. It seems like my only choice is monthly or longer. But that means I need to wait an entire month to test this. I assume there must be a way to test this (without waiting a full month), but I'm stumped. Does anyone have any insight? Thanks in advance. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 15, 2014 Share Posted October 15, 2014 If you are testing it on a demo WHMCS simply run admin/cron.php file. If it's a live WHMCS use the "Generate Due Invoices" (it's in the summary of every client). It's like running cron.php but it only works on the selected client. Said that, to test a "ModuleSuspend" just set yesterday date in Next Due Date and run cron.php or "Generate Due Invoices". If your module works the service should become suspended. IMPORTANT: sadly it's not possible to run cron.php and "Generate Due Invoices" multiple times in a row. You have to delete all entries created by WHMCS in tblinvoices and tblinvoiceitems during your test. Once done you can start a new test. 0 Quote Link to comment Share on other sites More sharing options...
robertb Posted October 16, 2014 Author Share Posted October 16, 2014 Hi Kian, Thanks for the reply. I just want to make sure I understand what you're saying... and I'm listing out the steps to help others that may find this thread in the future.... 1. Login to Admin Panel 2. Locate "Test User" customer account 3. On Products/Services tab, change "Next Due Date" to yesterday's date. 4. Click "Generate Due Invoices" (on the left column of the homepage) or run the cron.php file. At this point, I am correct in assuming that if my "test user" has a valid credit card on file, then it will renew successfully OR if they have an invalid credit card on file it will suspend due to non-payment? Thanks again! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 16, 2014 Share Posted October 16, 2014 (edited) 1. Login to Admin Panel2. Locate "Test User" customer account 3. On Products/Services tab, change "Next Due Date" to yesterday's date. 4. Click "Generate Due Invoices" (on the left column of the homepage) or run the cron.php file. 5. WHMCS generates due invoice (unpaid) and runs module suspend function to suspend the product. At this point if your module is working properly you should have a suspended service with its related unpaid invoice. You have successfully tested automatic suspension 6. Now you can test automatic renewal. Login as client to pay the invoice or manually add the payment from back end (open invoice > add payment). 7. As soon as the invoice becomes paid, WHMCS runs module unsuspend function and updates next due date adding 1, 3, 6, 12, 24 (...) months depending on the billing cycle configured on your product. If it happens your module is working also with renewals Edited October 16, 2014 by Kian 0 Quote Link to comment Share on other sites More sharing options...
robertb Posted October 16, 2014 Author Share Posted October 16, 2014 Thanks so much, Kian. Your response was incredibly helpful! This will help a ton with my testing. Let me ask you one more thing.... If I want to test out just a standard renewal where the customer has a valid credit card on file and it automatically processes on their renewal date (so I can see if it triggers the API), what is the best way to go about doing this? I can follow your steps, but I don't actually want it to suspend and then unsuspend the user. I just want it to generate the renewal invoice and charge it at the same time. So, the customer would have a new "paid" invoice and I can see if the API triggered upon successful automated renewal. If I just keep a valid credit card in the account and then follow steps 1-4, will that work and generate the new paid invoice? Cheers! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 16, 2014 Share Posted October 16, 2014 Then you should change next to date depending on the value you have in Setup > Automation Settings > Billing Settings > Invoice Generation. Let' say that you set WHMCS to generate invoices 14 days before the due payment date. Change next to date to something between today and today + 14 days then run cron.php or Generate Due Invoices. WHMCS should generate an unpaid invoice and immediately set it as paid without running any module function if your service was already active. If it was suspended it should runs module unsuspend. 0 Quote Link to comment Share on other sites More sharing options...
robertb Posted October 16, 2014 Author Share Posted October 16, 2014 Hi Kian, Thank you so much for your continued expert input! I tried to follow your instructions to test a successful automated renewal, but didn't have any luck. I'm wondering if I did something wrong....? Setup > Automation Settings > Billing Settings > Invoice Generation = 14 Days Setup > Automation Settings > Credit Card Charging Settings > Process Days Before Due = 0 Days 1. Create New user account 2. Activate a product (today's date is October 16) 3. From Admin Panel, change "Next Due Date" to October 18 (2 days from now) 4. Run cron.php I can see an "Unpaid" invoice is generated. But, it does not seem like WHMCS tried to charge the card at all to change it to 'paid' right away. My best guess is that this is due to the "Process Days Before Due" setting of "0". Am I correct in assuming that means WHMCS will only try to charge the credit card for this invoice on October 18? And then that would explain why it is still unpaid without a charge attempt. Cheers! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 16, 2014 Share Posted October 16, 2014 I could be wrong but "Process Days Before Due = 0 Days" sounds like a disabled feature to me. Maybe it should be set to 1. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.