Jump to content

Is there a way to automatically pay invoices with credit before suspending?


mustardman

Recommended Posts

I understand that WHMCS is designed to grab credit to pay invoices at the time the invoice is generated. I need it to do that after invoices are generated before suspending the account. I have the system set up to generate invoices several days before the due/suspension date.

 

I have opened tickets with WHMCS and their response was that WHMCS doesn't work that way. So is there some other way? An addon module or hook or something?

 

I can't change human nature and what customers end up doing a lot of the time is adding credit instead of paying their invoices. Then I get an angry ticket when their service is suspended because they think they already paid their invoice. Then I have to manually move the credit to the invoice.

 

There should be some way to make that happen automatically.

Edited by mustardman
Link to comment
Share on other sites

I don't think there is out of the box, but perhaps there should be as it makes sense to apply credits to any due invoices. If you know php, you could use the InvoicePaid hook, since adding credits create invoices, to then check available credits and then apply to due invoices. http://docs.whmcs.com/Hooks:InvoicePaid http://docs.whmcs.com/API:Get_Clients_Details -> credit . http://docs.whmcs.com/API:Get_Invoices http://docs.whmcs.com/API:Apply_Credit . The trick will be if there are multiple invoices, which invoice to apply and how much -- the spread. Also, auto applying credits may cause invoices for like domain renewals that customers don't want to go through. So, it could also cause issues. Also some customers like to apply how they see fit. Perhaps just editing the credit page stating you need to apply the credits to invoices manually.

Link to comment
Share on other sites

I don't think there is out of the box, but perhaps there should be as it makes sense to apply credits to any due invoices. If you know php, you could use the InvoicePaid hook, since adding credits create invoices, to then check available credits and then apply to due invoices. http://docs.whmcs.com/Hooks:InvoicePaid http://docs.whmcs.com/API:Get_Clients_Details -> credit . http://docs.whmcs.com/API:Get_Invoices http://docs.whmcs.com/API:Apply_Credit . The trick will be if there are multiple invoices, which invoice to apply and how much -- the spread. Also, auto applying credits may cause invoices for like domain renewals that customers don't want to go through. So, it could also cause issues. Also some customers like to apply how they see fit. Perhaps just editing the credit page stating you need to apply the credits to invoices manually.

 

I think it would need to be selectable per product/service to handle things like that. Probably would need the ability to disable per customer as well. None of those things should be a problem for what I am doing, so a custom solution for myself would not need any of that.

Edited by mustardman
Link to comment
Share on other sites

Short version, yes.

 

use PreModuleSuspend , get the service id, then the invoice id, call API::Apply Credit. If invoicepaid = TRUE, then follow the abort instructions at the bottom of the page of PreModuleSuspend

 

This will do precisely what you're looking for.

 

That sounds like a nice solution. Will try code that up. Thanks for the suggestion.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated