How can we improve WHMCS?

Share, discuss and vote for what you would like to see added to WHMCS

Adjust Credit on UpdateInvoice



when you are using the api Command UpdateInvoice and you delete with it a line item, the total will be correct adjust, but the applied Credit is equal to the old total.

Thus it can happen that the invoice amount is only 10$, but the invoice has 15$ of credit assigned.
It would be useful if the function corrects the assigned credit if the invoice amount is less than the credit.

4 Comments

Login to post a comment.

This is similar to the problem I've described in my request—pending moderator approval: https://requests.whmcs.com/idea/automatically-removeedit-invoice-overpayment-credits-when-overpayment-transaction-is-removed-or-invoice-is-changed
Hi there,
Thanks for your suggestion. At present the API behaviour is consistent with the behaviour of the admin UI. So any changes would likely need to be made to both places.
How would everyone feel about that more broader change?
When an invoice is overpaid, I see a credit added inside Manage Credits. For example:
04/19/2023 Invoice #240224 Overpayment $150.89

It would make sense to me if that specific overpayment credit was automatically adjusted based on the current overpaid invoice balance. If the invoice amount changes or the transaction is deleted, the overpaid invoice balance is different so this credit line item should be automatically adjusted (or a new counterbalancing credit line item is added to adjust the total credit balance to reflect the invoice balance). Here are scenarios that would warrant/trigger a credit adjustment:

- Overpaid invoice is deleted
- Overpaid invoice transaction is deleted
- Overpaid invoice line item is deleted
- Overpaid invoice line item amount is changed
- Overpaid invoice has credits removed
The list of triggers should also include "Overpaid invoice line item is added":

- Overpaid invoice is deleted
- Overpaid invoice transaction is deleted
- Overpaid invoice line item is added
- Overpaid invoice line item is deleted
- Overpaid invoice line item amount is changed
- Overpaid invoice has credits removed