Supplier refunded purchase invoice

I have done a purchase invoice with advance payment via credit card, and the supplier cancelled the purchase invoice and wire me the money back minus some fees, how do i record this transaction, i did a receipt on the funds but the purchase invoices are hanging and show the purchased items on inventory

Do a Debit Note to cancel the Purchase Invoice

debit note or credit note? on purchase invoices only allows to record credit notes, and recording the refund with a receipt is ok?

Record the paynent from the supplier as a receipt

https://www2.manager.io/guides/7426