1. First create a credit note

2. Go to Sales Invoice / Purchase Invoice 
3. Click to Edit the invoice you want to apply the credit note

4. Go to the Transaction tab on the left

5. Click the button Use a credit note

6. Choose the Credit Note you have created from the list, and click Use to apply
Please make sure the invoice got outstanding. If no outstanding need to do refund in invoice. (refer below the screenshot)

7. After you can check back the Credit note is apply in which invoice in Credit Note page.