Order Processing with REST APIs Tutorial
Step 8. Create an invoice
You create an invoice after you receive payment for an order. In this example, the order was paid offline via a bank transfer. Therefore, you must tell Magento that payment for the order has been captured.
Capture payment
This example creates a full invoice. You can create a partial invoice by adding to the payload an array of items to be invoiced.
Endpoint
POST http://<host>/rest/default/V1/order/3/invoice
where 3
is the orderid
Headers
Content-Type
application/json
Authorization
Bearer <administrator token>
Payload
Response
An invoice id
, such as 3
.
View the invoice
An invoice is structurally similar to an order, but an order contains more details.
Endpoint
GET http://<host>/rest/default/V1/invoices/3
Headers
Content-Type
application/json
Authorization
Bearer <administrator token>
Payload
Not applicable
Response
You will use the order_item_id
values to create a shipment in the next step.
Verify this step
Log in to Admin. Click Sales > Invoices. The invoice is displayed in the grid. The status is Paid. Then click Sales > Orders. The status is Processing.