Applying credit to an invoice but receiving error

Self hosted on hostgator through Softaculous.
I’m trying to apply a credit as a payment to an invoice, but when I press Save, a popup comes up with error “An error occurred, please refresh the page and try again.
When I refresh the page, it’s still the same.

Please check the credit has enough balance to cover the payment amount

The invoice amount is: 25725.00
Credit amount is: 7,129.08

I need to do either of the following:
a) Deduct the credit amount from invoice amount, and give that as balance to client (18595.92)
b) Deduct this credit amount from multiple invoices

You should be able to create a payment for the credit balance amount

Sorry, I didn’t understand what you meant.

When you see the error how much are you setting for the payment amount?

The complete credit amount, which is: 7,129.08

Is that the credit total or the credit balance?

The invoice total amount = 25,725.00
I created a credit amount in Credits for the same client of = 7,129.08

Now, I’m trying to apply this credit amount to the invoice. Therefore, I created a Payment for the client. Selected the particular invoice (25,725.00). In Payment Type, I selected ‘Apply Credit | 7,129.08’. Payment Date I selected for 17 February 2020. Then, when I click ‘Save’, it gives me the above error.

What amount are you entering in the payment amount? If it’s the full invoice amount you will see an error because the credit doesn’t have enough funds to cover it.

Got it.
Actually I was mistakenly letting the system select the total amount of the invoice in ‘Amount’ field. Whereas, I was supposed to manually enter the credit amount.
Thanks for guiding.