The first step to create a Credit note or Refund is to create a Product return.
You have 2 ways to create Product returns:
1. Directly from the Product returns menu: Sales > Product Returns
In this case, the product return will not be linked to any prior Sales Order or Invoice.

2. From a Sales Order or Invoice
This is the recommended way to create a Product return as it will be linked to the Sales Order or Invoice. You will find the 'Product returns' section on the left side of the Sales Order or Invoice:

For Sales Orders, you will only see this button once you have created at least one Shipping Order and its status set at 'Delivered'.
If the Invoice has been created from a Sales Order, the "Create Product Return" button will be in the Sales Order, not in the Invoice.
Review or update the quantity to be returned:

You can the returned items back to your inventory by selecting 'Add returned products to inventory'.
If you chose to add the returned product(s) back to your inventory, you will need to click on 'Receive Products' to have the products available in your inventory. You will find this option once you save the Product return in 'Actions':

Once you have created (saved) the Product Return, you can either create a Refund or a Credit Note. If you created the Product return from a Sales Order or Invoice, the Refund or Credit Note will automatically include the price of the product(s) from the Sales Order or Invoice.
If you didn't create the Product Return from a Sales Order or Invoice, the price of the Product will be Zero as it is not linked to the 'Sold price' included in the Sales Order or Invoice.
Credit Notes
From a product return
You just need to click on 'Create a credit note' in the credit notes section, check the numbers and save.

You can find the list of all your Credit notes by going to the menu Sales > Credit notes.
When a customer has an uncredited credit note available, you'll have the option to select it in the 'Payments' section of your sales documents.
Refunds
To create a Refund, open the Product return and click on 'Create refund'. Check the numbers and save.

Just like any other document, you can generate a PDF for the Refunds and send by email.
You can find the list of all your Refunds by going to the menu Sales > Refunds.