Model/Service/InvoiceService.php
public function prepareInvoiceWithoutItems(OrderInterface $order, $amount)
    {
        try {
            $invoice = $this->orderConverter->toInvoice($order);
            $invoice->setBaseGrandTotal($amount);
            $invoice->setSubtotal($amount);
            $invoice->setBaseSubtotal($amount);
            $invoice->setGrandTotal($amount);

            $order->getInvoiceCollection()->addItem($invoice);

            return $invoice;
        } catch(\Exception $e) {
            $this->bugsnag->notifyException($e);
            throw $e;
        }
    }
public function prepareInvoiceWithoutItems(OrderInterface $order, $amount)
    {
        try {
            $invoice = $this->orderConverter->toInvoice($order);
            $invoice->setBaseGrandTotal($amount);
            $invoice->setSubtotal($amount);
            $invoice->setBaseSubtotal($amount);
            $invoice->setGrandTotal($amount);

            $order->getInvoiceCollection()->addItem($invoice);

            return $invoice;
        } catch(\Exception $e) {
            $this->bugsnag->notifyException($e);
            throw $e;
        }
    }
public function prepareInvoiceWithoutItems ( OrderInterface $ order , $ amount ) { try { $ invoice = $ this -> orderConverter -> toInvoice ( $ order ) ; $ invoice -> setBaseGrandTotal ( $ amount ) ; $ invoice -> setSubtotal ( $ amount ) ; $ invoice -> setBaseSubtotal ( $ amount ) ; $ invoice -> setGrandTotal ( $ amount ) ; $ order -> getInvoiceCollection ( ) -> addItem ( $ invoice ) ; return $ invoice ; } catch ( \ Exception $ e ) { $ this -> bugsnag -> notifyException ( $ e ) ; throw $ e ; } }
Prepare order invoice without any items

@param \Magento\Sales\Api\Data\OrderInterface $order
@param                                        $amount

@return \Magento\Sales\Model\Order\Invoice
@throws \Exception
Prepare order invoice without any items