ARTICLE

Magento 2 Invoices, Shipments, and Credit Memos: Online vs Offline Refunds, Partial Invoicing, and the Order Lifecycle

Magento 2 Invoices, Shipments, and Credit Memos: Online vs Offline Refunds, Partial Invoicing, and the Order Lifecycle

In Magento 2, an order is a request, and three documents record what happened to it. An invoice records payment and can capture it. A shipment records what left the warehouse. A credit memo records a refund and can send money back. Each can be partial, and the order’s state follows from how much is invoiced, shipped, and refunded.

Understanding that model answers the questions that reach every support desk: why the Refund button only offers “Refund Offline”, why an order will not cancel, why a refunded order is still Complete, and where the money actually moved. This guide covers each document, the payment behavior behind it, and the services you call when you automate the flow.

One order, three kinds of document

Document Records Can move money Main tables Effect on order items
Invoice That items are billed Yes, when captured online sales_invoice, sales_invoice_item Raises qty_invoiced
Shipment That items were dispatched No sales_shipment, sales_shipment_item, sales_shipment_track Raises qty_shipped
Credit memo That items or amounts were refunded Yes, when refunded online sales_creditmemo, sales_creditmemo_item Raises qty_refunded

The order row itself stores running totals such as total_paid and total_refunded, and each line in sales_order_item stores qty_ordered, qty_invoiced, qty_shipped, qty_refunded, and qty_canceled. Those counters are the real state of an order. When something looks wrong, compare them before anything else.

Documents are additive. You never edit an invoice to fix it. You create another document, such as a credit memo, that offsets it. That keeps an audit trail that accounting can rely on.

Invoices: billing and capture

Adobe’s invoices documentation describes an invoice as the record of payment for an order, notes that one order can have several invoices covering all or some of its products, and adds a consequence people miss: once an order is invoiced, it can no longer be canceled or changed.

When the invoice is created

It depends on the payment method’s payment action.

  • Authorize and Capture. The card is charged at checkout and the invoice is created automatically. Adobe notes the Invoice button does not appear in this case, and the order is ready to ship.
  • Authorize. Funds are reserved at checkout. Nothing is captured until someone creates the invoice.
  • Offline methods. Check, bank transfer, cash on delivery, and purchase order have no gateway. An admin creates the invoice when payment is confirmed. Adobe states invoices are not created automatically for gift card, store credit, reward points, or other offline methods.

The three capture options

When you create an invoice by hand for an order paid through a gateway with an open authorization, the Amount dropdown offers three choices.

Option What happens Resulting invoice state
Capture Online Magento calls the gateway and captures against the authorization Paid
Capture Offline Magento marks the invoice paid without calling the gateway Paid
Not Capture The invoice is created but payment is left open, to capture later from the invoice Pending

Capture Offline is the option that causes trouble later. It is meant for cases where the money was taken outside Magento, for example in the gateway’s own dashboard. An invoice captured offline has no gateway transaction attached, so it can never be refunded online from Magento. If a team captures offline out of habit, every later refund becomes a two step manual job.

Authorizations do not last forever. Card networks and gateways release them after a period that varies by provider, so an order that sits authorized for too long may fail at capture. If your fulfillment time is long, check your gateway’s authorization window.

Partial invoices

On the invoice form, change Qty to Invoice per line and click Update Qty’s. The invoice covers only those quantities, and with online capture only that amount is captured. Remaining quantities can be invoiced later. Whether the gateway allows several partial captures against one authorization is up to the payment method, so test it with yours. Our comparison of Magento payment gateways on Hyva covers how the main providers differ.

Shipments: fulfillment and tracking

A shipment records which quantities were dispatched and holds tracking numbers. It does not touch payment. You can create it on its own from the order, or together with the invoice by ticking Create Shipment on the invoice form.

Things worth knowing:

  • Partial shipments work the same way as partial invoices. Each one raises qty_shipped on the lines it includes.
  • Tracking numbers are rows in sales_shipment_track and can be added after the shipment exists.
  • Virtual and downloadable products have nothing to ship. An order containing only those becomes Complete as soon as it is fully invoiced.
  • Shipments cannot be deleted from the admin. A mistaken shipment is corrected operationally, not by removing the record.
  • Inventory. With Multi Source Inventory, creating the shipment is the point where you choose which source the stock is deducted from.

Shipping in Magento does not capture payment by itself. Merchants who want “capture when shipped” for authorize only orders implement it as a customization or integration that creates the invoice with online capture when the shipment is created.

Credit memos: refunds

Adobe’s credit memo documentation defines a credit memo as the document showing the amount due to the customer for a full or partial refund. It also sets the precondition: with an authorize payment action you must create an invoice before a credit memo, because you cannot refund what was never billed.

Online vs offline refund

Refund (online) Refund Offline
Moves money Yes, Magento calls the gateway No, it only records the refund in Magento
Where you start From the invoice: open the invoice, then Credit Memo From the order or the invoice
Requires An invoice captured online, and a payment method that supports refunds Any invoiced order
Typical use Card and wallet payments Check, cash on delivery, bank transfer, or refunds already issued elsewhere

Adobe notes that you can issue an offline refund for any payment method. That flexibility is also the risk: an offline refund on a card order returns nothing to the customer unless someone also refunds it at the gateway.

Why the online Refund button is missing

This is one of the most common admin questions, and there are four causes.

  1. The credit memo was started from the order page. The order level Credit Memo button only offers Refund Offline. Open the specific invoice and click Credit Memo there.
  2. The invoice was captured offline. There is no gateway transaction to refund against.
  3. The payment method does not support online refunds, or a custom payment module does not declare that it can refund.
  4. The gateway transaction is missing or closed. Check the Transactions tab on the order.

Once a credit memo has been saved as an offline refund, it cannot be switched to online. Refund at the gateway by hand and leave the Magento record as it is.

Partial refunds, shipping, and adjustments

The credit memo form lets you shape the refund:

  • Qty to Refund per line, followed by Update Qty’s, for a partial item refund.
  • Refund Shipping, which defaults to the shipping amount not yet refunded and can be lowered or set to zero.
  • Adjustment Refund, an extra amount added to the refund, used for goodwill or to refund an amount with no item attached.
  • Adjustment Fee, an amount subtracted from the refund, used for a restocking charge.
  • Return to Stock, a per line checkbox that puts the quantity back into inventory. Whether it is ticked by default is controlled under Stores > Configuration > Catalog > Inventory > Product Stock Options.

Adobe Commerce adds a refund to store credit option, and B2B adds payment on account and company credit. Our article on Magento gift cards and store credit on Hyva covers those flows, and our guide to returns and RMA management on Magento and Hyva covers the customer facing process that leads up to the credit memo.

Credit memos, like invoices, cannot be edited or deleted after they are saved. Check the totals before you submit.

Cancel, void, or refund?

These three are often confused, and the right one depends on how far the order has gone.

Situation Action Result
Not invoiced, offline payment Cancel Order canceled, reserved stock released
Authorized, not captured Cancel or Void Authorization released at the gateway, no charge
Invoiced and captured Credit memo Money refunded, order closes when fully refunded
Partly invoiced Credit memo for the invoiced part, cancel for the rest Remaining quantities recorded as canceled

Cancel disappears from the order once everything is invoiced. That is by design: after money has been captured, the only correct way back is a credit memo.

How documents drive the order state

Magento recalculates the order state from the documents each time the order is saved:

  • Something invoiced or shipped, but not both in full: Processing.
  • Fully invoiced and fully shipped (or fully invoiced with nothing to ship): Complete.
  • Everything invoiced has been refunded: Closed.

This explains two things that look like bugs. A partially refunded order stays Complete, because there is still invoiced value that has not been refunded. And you cannot set Complete or Closed by hand, because they are consequences of documents, not choices.

Automating the flow from code or an integration

For ERP, warehouse, and returns integrations, use the service contracts. Do not build invoice or credit memo models by hand. Adobe’s REST tutorial on creating an invoice for an order shows the request shape.

Task PHP service interface REST route
Invoice an order, optionally capturing Magento\Sales\Api\InvoiceOrderInterface POST /V1/order/:orderId/invoice
Ship an order with tracking Magento\Sales\Api\ShipOrderInterface POST /V1/order/:orderId/ship
Refund against an invoice, online or offline Magento\Sales\Api\RefundInvoiceInterface POST /V1/invoice/:invoiceId/refund
Refund an order offline Magento\Sales\Api\RefundOrderInterface POST /V1/order/:orderId/refund

The split in the last two rows mirrors the admin. The invoice route accepts an isOnline flag and can reach the gateway. The order route is offline only.

Each service accepts item quantities for partial documents, a notify flag for the customer email, and an optional comment. These emails go out through the same queue as order emails when asynchronous sending is enabled, which our guide to Magento 2 email templates and asynchronous order email sending explains.

Two integration rules save a lot of cleanup. Make calls idempotent on your side, because a retried “ship” call creates a second shipment if quantities remain. And reconcile against the item counters, not the status label.

What changes on a Hyva storefront

Nothing in the document model. Invoices, shipments, and credit memos are created in the admin or through APIs. On the storefront, customers see them in the account area under each order, where Hyva supplies its own templates for the invoice, shipment, and refund tabs and the print views. If you customize those views or add tracking links, that is theme work, and it is part of what our Hyva development services cover.

Mapping to other platforms

If you are migrating, expect to translate concepts. Shopify tracks payment status and fulfillment status separately on the order with fulfillments and refunds as child records. BigCommerce uses order statuses with shipments and refunds attached. Shopware runs separate state machines for the order, its transactions, and its deliveries. None of them has a direct equivalent of the Magento invoice as a document separate from payment, so historic invoice numbers need a home in the target system before you import.

Where Bemeir fits

Bemeir is a Brooklyn agency that builds and supports Magento and Adobe Commerce stores, including the order management integrations that create these documents automatically. That work is part of our Magento development services. Read more about Bemeir or see our technology partners.

FAQ

What is the difference between an invoice and a credit memo in Magento 2?

An invoice records that items were billed and, when captured online, charges the customer. A credit memo records a refund against invoiced items and, when refunded online, returns money through the gateway. A credit memo can only be created after an invoice exists.

Why does Magento only show Refund Offline?

Either the credit memo was opened from the order page, the invoice was captured offline, or the payment method does not support online refunds. Open the invoice that was captured online and create the credit memo from there to get the online Refund button.

Can I cancel an order after it has been invoiced?

No. Adobe states that invoicing locks the order so it can no longer be canceled or changed. After invoicing, reverse the order with a credit memo.

Does creating a shipment charge the customer?

No. A shipment only records fulfillment and tracking. Payment is captured by an invoice. Stores that want to charge at dispatch create the invoice with online capture at the same time as the shipment.

Why is my order still Complete after a refund?

The refund was partial. An order moves to Closed only when everything that was invoiced has been refunded. Until then it keeps the state it had.

Let us help you get started on a project with Magento 2 Invoices, Shipments, and Credit Memos: Online vs Offline Refunds, Partial Invoicing, and the Order Lifecycle and leverage our partnership to your fullest advantage. Fill out the contact form below to get started.

more articles about ecommerce

Read on the latest with Shopify, Magento, eCommerce topics and more.