Invoice
Magento\Sales\Model\Order\Invoice
What it does
The Invoice class represents a sales invoice in Magento 2, used when creating invoices for customer orders.
Developers use this class to create, manage, and process invoices including capturing payments, registering totals with orders, canceling/voiding invoices, and managing invoice items and comments.
It handles all financial calculations, state management (open/paid/canceled), and integration with the order and payment systems.
Public Methods
- loadByIncrementId()
- getConfig()
- getStore()
- setOrder()
- getOrder()
- getEntityType()
- getBillingAddress()
- getShippingAddress()
- isCanceled()
- canCapture()
- canVoid()
- canCancel()
- canRefund()
- capture()
- pay()
- wasPayCalled()
- void()
- cancel()
- collectTotals()
- roundPrice()
- getItemsCollection()
- getAllItems()
- getItemById()
- addItem()
- getStates()
- getStateName()
- register()
- isLast()
- addComment()
- getCommentsCollection()
- reset()
- getItems()
- getComments()
- getIncrementId()
- getBaseTotalRefunded()
- getDiscountDescription()
- setItems()
- getBaseCurrencyCode()
- getBaseDiscountAmount()
- getBaseGrandTotal()
- getBaseDiscountTaxCompensationAmount()
- getBaseShippingAmount()
- getBaseShippingDiscountTaxCompensationAmnt()
- getBaseShippingInclTax()
- getBaseShippingTaxAmount()
- getBaseSubtotal()
- getBaseSubtotalInclTax()
- getBaseTaxAmount()
- getBaseToGlobalRate()
- getBaseToOrderRate()
- getBillingAddressId()
- getCanVoidFlag()
- getCreatedAt()
- setCreatedAt()
- getDiscountAmount()
- getEmailSent()
- getGlobalCurrencyCode()
- getGrandTotal()
- getDiscountTaxCompensationAmount()
- getIsUsedForRefund()
- getOrderCurrencyCode()
- getOrderId()
- getShippingAddressId()
- getShippingAmount()
- getShippingDiscountTaxCompensationAmount()
- getShippingInclTax()
- getShippingTaxAmount()
- getState()
- getStoreCurrencyCode()
- getStoreId()
- getStoreToBaseRate()
- getStoreToOrderRate()
- getSubtotal()
- getSubtotalInclTax()
- getTaxAmount()
- getTotalQty()
- getTransactionId()
- setTransactionId()
- getUpdatedAt()
- setComments()
- setUpdatedAt()
- setStoreId()
- setBaseGrandTotal()
- setShippingTaxAmount()
- setTaxAmount()
- setBaseTaxAmount()
- setStoreToOrderRate()
- setBaseShippingTaxAmount()
- setBaseDiscountAmount()
- setBaseToOrderRate()
- setGrandTotal()
- setShippingAmount()
- setSubtotalInclTax()
- setBaseSubtotalInclTax()
- setStoreToBaseRate()
- setBaseShippingAmount()
- setTotalQty()
- setBaseToGlobalRate()
- setSubtotal()
- setBaseSubtotal()
- setDiscountAmount()
- setBillingAddressId()
- setIsUsedForRefund()
- setOrderId()
- setEmailSent()
- setCanVoidFlag()
- setState()
- setShippingAddressId()
- setStoreCurrencyCode()
- setOrderCurrencyCode()
- setBaseCurrencyCode()
- setGlobalCurrencyCode()
- setIncrementId()
- setDiscountTaxCompensationAmount()
- setBaseDiscountTaxCompensationAmount()
- setShippingDiscountTaxCompensationAmount()
- setBaseShippingDiscountTaxCompensationAmnt()
- setShippingInclTax()
- setBaseShippingInclTax()
- setBaseTotalRefunded()
- setDiscountDescription()
- getExtensionAttributes()
- setExtensionAttributes()