You can get the Credit memo collection details for the specific order by an order id using Magento 2.
Using Magento\Sales\Api\CreditmemoRepositoryInterface interface, you need to use getList() function to fetch no. of credit memo by sales order id.
Using SearchCriteriaBuilder Class, You need to filter by order id and pass search criteria object to getList() method of CreditmemoRepositoryInterface. Continue reading “Get Credit memo details by order id programmatically Magento 2.”