Get Credit memo details by creditmemo id Magento 2.

Magento 2 contains Out of the Box Native feature of Credit memo generation from admin panel for an order after invoice generated.

What is a Credit Memo?

After a customer places and pays for an order for an online payment method and an invoice has been issued for the specific order, Merchant can create a credit memo to refund all or part of the amount paid for any returned or undelivered items.

The memo restores funds to the customer account or refunds to the customer bank account used for an order so that the customer can make future purchases.

Database Table used the store the data:
sales_creditmemo

You can get full details of Creditmemo related data using credit memo id in Magento 2.

Using Magento\Sales\Api\CreditmemoRepositoryInterface class you can get details of credit memo related data in Magento 2.

Pass Creditmemo id to fetch creditmemo records from database table.

echo “<pre>”;print_r($creditMemo->debug());exit;