How to return a payment for Purchase Order?

I have a Purchase Order and a Payment Entry for that PO. So I have a SO that needs to be invoiced for as well as a negative “Outstanding Amount” for that Supplier in the “Accounts Payable” report. That is all correct.

Now it has turned out the Supplier can not deliver the Ordered and paid items and they have refunded the money to our bank account.

I have no idea how I can book that return payment in a way it is connected with the Sales Order and likewise renders the Accounts Payable for that supplier = 0. Naturally I can not cancel the Payment Entry as the payment has happened and also is recorded in our banks statement naturally.

Can anybody advise how to balance this situation?

I have tried to issue a Return Purchase Invoice from that SO, but can’t manage to get the balance with the supplier to 0 doing so.

Would a Debit Note do what you need?