By default, WHMCS will only attempt to capture payment from the default payment method a few times, based on the retry settings that you have in “Automation Settings”.
This PHP file and the associated hook will attempt to capture payment from all payment methods in a client’s account, on a daily basis.
There’s two files here, so I’ll explain each of them.
The first file, retry-invoice.php needs to be uploaded to your server, and can be outside the public_html folder, eg /home/whmcs/. Once you’ve uploaded it, update the path at the top to the path to the init.php file inside your WHMCS public_html folder, and also the number of days to cancel an invoice on line 16, based on your overdue termination policies. Eg, we use 60 days.
You’ll then need to create a cronjob that runs daily, at some point after your WHMCS daily cron. Eg, if your WHMCS daily cron runs at 9am, you could run this 2 hours later at 11am.
The second file, presend.php needs to be uploaded to the ‘/includes/hooks/’ folder for your WHMCS install, eg /home/whmcs/public_html/includes/hooks. Once you’ve uploaded it, update the hour on line 8 from 11 to whichever hour you have created the cronjob for retry-invoice.php for. This is to avoid sending multiple emails to clients about failed Credit Card captures.
That’s it! You can check the WHMCS Activity Log to see the attempts, and you should notice that you’re more likely to get paid on overdue invoices.