Reimbursement to a customer who overpaid


Yesterday I faced a situation that does not seems to be handled by ERPNext.

Customer overpays a Sales Invoice by mistake. Payment is processed with a Payment Entry and the full amount is entered, leaving an unallocated amount on the customer account. No other invoice is planned for this customer, so he ask for a reimbursement (keeping the money as a credit that can be eventually be used on a Sales Invoice in not an option).

Reimbursement is not possible with a Payment Entry, because there is no negative outstanding invoice:

Because a Journal Entry cannot be linked to a Payment Entry, this is also not an option, since the Journal Entry would not clear the unallocated amount.

The only solution I found is to enter only the amount of the Sales Invoice when making the Payment Entry. Create a Journal Entry to put the unallocated amount on the customer account, then do another Journal Entry linked to the first one to emit a payment to the customer.

I think that the unallocated amount should be allowed in Payment Entry, like they can be fetched as an Advance on a Sales Invoice.

Is there a better way to handle this?

Thank you

1 Like

@lefebvre_bern Use Journal entry and remember to select it is advance when the customer pay.Issue your sales invoice and click on get advance.Allocate the invoice value the remaining will be an outstanding in the customer accout.Then use Payment entry to pay him the balance in his account.
I believe i am clear.

Hi @Fred1

Your solution would work if the payment is received in advance, but it is not the case here. The Invoice is already submitted when the payment is received, so what if I do not want to have the user cancel the Invoice?

Thank you

@lefebvre_bern Demo.I raised an invoice of $344 for a customer.He later paid $600.I used payment entry to receive the money.$344 is allocated to the invoice and the remaining balance of $256 is unallocated and kept in the account of the customer.Use Journal to pay the customer.Credit the cash/bank and debit the customer.It is tue that you cannot use payment entry to pay back but journal does it neat.Simply.
However if you want payment entry to be enhanced to hand it straight away,you can raise a github issue for that

1 Like


With your example, the unallocated 256$ is linked with the Payment Entry. Even if you use a Journal Entry to pay the Customer, it does not clear the amount on the customer account, because it is not possible to link a Journal Entry with a Payment Entry.

Try it, do the Journal Entry, then create an invoice for that customer and try to get “Advances” on the invoice. The 256$ will still be fetched, even if you removed the 256$ from the customer account.

@lefebvre_bern I am on ERPNext: v9.1.4 (master) Frappe Framework: v9.1.6 (master) .What you are saying is not correct.If you use journal to pay the balance it will clear the outstanding balance from the customer account because in the journal entry you are going to select Debtor and the party will be the customer .Why will it not land in the customer account.Follow the example above.
1.Create the invoice.2 Receive the total amount from the customer through the payment entry.3Use journal to pay back what the customer pay in excess(no need of selecting the advance because you are going to debit the customer).Here i end my case.ERPnext can handle your case.



@Fred1, I am on ERPNext: v8.11.0 (master) and Frappe Framework: v8.10.3 (master). Maybe it makes a difference, but I doubt it.

  • New Sales Invoice
    • total amount 287.44$
  • Payment Entry
    • Paid Amount = 300$
    • Unallocated Amount = 12.56$
  • Journal Entry:
    • Account = Account receivable, Party = Customer, Debit = 12.56$, Reference = none (Payment Entry is not supported)
    • Account = Bank Account, Credit = 12.56$
  • New Sales Invoice, same Customer as 1st invoice
    • Advance Payments, Get Advances Received
      • PE-00XYZ
      • Advance Amount = 12.56$

ERPNext still fetch the unallocated amount of the Payment Entry, because it could not be linked with the Journal Entry.
I am not saying that I cannot reimburse the customer, I am saying that the reimbursement does not clear the unallocated amount on the Payment Entry.

1 Like

Profile - lefebvre_bern - Frappe Forum, I concur with your finding and testing and am on v9 of ERPNext.

Profile - Fred1 - Frappe Forum, did you actually try what Profile - lefebvre_bern - Frappe Forum was referring to?

If you did, you would have experienced exactly as he did.

@lefebvre_bern all the picture i got from your ealier posts is that you cannot do reimbursement. But if your concern is clearing the advance payment ,raise an issue for that and the team will take it up from there.Thanks

@Fred1 I will open an issue, but I wanted to check with the community if there was a better way to handle this situation before doing so.

Thank you

@lefebvre_bern look at the solution.Use payment entry to receive the total amount paid by the customer (let say $600).Asumming the sale invoice is $344.Allocate the amount $344 in the payment entry,the unallocated $256 should be paid back to the customer in form of cash or through a bank account by selecting the cash account or the bank account in Deduction or Loss section in the payment entry environment,select the cost centre and put-$256 (negative 256) in the amount column since your are paying the money out.With this the customer is paid back and there is nothing left unallocated.
Even though this solves your problem,in real life the money may not be paid immediately.Hence there is need to allow the money to be transfered to the customer account pending the time for repayment.Hence in the Deduction or Loss Section the debtor account should be made useable by inseting a column :Party.Raise this issue

@lefebvre_bern Hi, I have the same situation, the customer overpaid but doesn’t want the money back.

The sales invoice and payment entry are already submitted, so I add a journal entry to debit the customer.
But the Accounts Receivables still show me 2 lines because I can’t link the payment entry as Reference Type in the journal entry JV-00001

For now, I cancelled my payment entry and amended it to allocate the overpaid amount in Deductions or Loss section, but I think it will be better to add the possibility to link a payment entry in journal entry line


Have you entered this point in GitHub ?
Maybe @nabinhait can validate that it is the good way of doing this.

Hi @britlog,

In your situation, I think making a “Sales Return” would be sufficient.

The situation I described was about using the Credit amount generated by a Sales Return as a deduction on the next Sales Invoice to that Customer. Let me know if this situation also applies to you, we have a solution for this.

Hi @lefebvre_bern,

I’m not sure because the customer don’t return anything, he has just paid more and don’t want the difference back. He paid 100$ but the sales invoice was 98$. In this case, the 2$ stayed unallocated in the payment entry and then impossible to debit customer with journal entry and get a clean accounts receivable report. The only solution is to cancel and amend payment entry with Deduction section to allocate all the paid amount (100$ here).


Sorry, I misunderstood. As far as I know, there is no fix for this at the moment. What you did is probably the best option. You can then move that amount into another account if needed.

We have the situation where a customer makes an advance payment but then cancels the order so we have to refund the payment. Do you know how to do this? I keep hitting the same “Cannot pay…” error, and creating a credit note doesn’t seem to make any difference.

Hi @DBoobis,

Sorry for the late response. I see that you have opened an issue about this.
For now, I think your only option is to either remove all traces of this transaction in ERPNext and reimburse manually the customer or cancel the Payment Entry and process everything through Journal Entry without using the “Is Advance” function.

I am working on a Credit Memo functionality that I expect to be a freestanding customization; ETA two weeks
Besides all the issues mentioned already, it’s not typical that a sales person should be able to make manual journal entries, but the smaller the organization the more hats people wear.

@lefebvre_bern thanks for the reply. We can’t remove all traces of the transaction because it will appear on the bank statement, and we can’t always cancel the payment entry as it may be partially applied.

The solution we have for now is to create a dummy invoice tied to the payment, credit that, then pay the credit. It is inelegant but keeps the audit trail and this situation doesn’t occur too often anyway.

Hi @lefebvre_bern

Trust you’re doing great. Did you (or anyone else) eventually create a Github issue for this? If so, could you please provide a link?