Get Invoice details by order increment id programmatically Magento 2.

You can get the invoice data for the specific order by order increment id in Magento 2.

Using Magento\Sales\Api\InvoiceRepositoryInterface interface, you need to use getList() function to fetch no. of invoice by sales order increment id.

When you check the sales_invoice table, order_id available in sales_invoice table so you first fetch the order entity id from the order increment id.

To get invoice records, you first fetch the order id by order increment id and pass order id as SearchCriteriaBuilder addfilter() method.

Pass search criteria object to getList() method of InvoiceRepositoryInterface to fetch invoice details by order increment id.

You can get a result as Invoice data by the above function,

You got the invoice object for the var_dump in the above output.