Hello Magento Friends,

Today I am going to explain How to Call API to Create a Full Invoice in Magento 2.

When the order is placed and the payment is received, the store owner can generate an invoice for the order. In Magento 2 you can create an invoice of an order using the third-party platform by calling an API.

Steps to Call API to Create a Full Invoice in Magento 2:

To create a partial Invoice, specify only those order_item_ids that are to be Invoice now.

If the call is successful on a full Invoice, Magento changes the status of an order to Processing.

Endpoint:

POST https://domain.com/rest/<store_code>/V1/order/1/invoice

// here 1 is Your Order Id and store_code (optional)

Headers:

Content-Type: application/json

Authorization: Bearer <administrator token>

Payload:

Response:

The Invoice ID, such as 1.

Verify this step

From Magento Admin, click Sales > Invoices. Invoices for this order are shown in the grid.

Create Invoice Example for Invoices using  REST API

Create invoice.php in your Magento root path after that add the below code.

After adding the above code run the below URL to check invoice created or not.

https://domain.com/invoice.php

Conclusion:

Hence, this way you can Call API to Create a Full Invoice in Magento 2.

Check out other related blogs – 

If you have any questions let me know in the comment box. I will be prompt to answer. Share the article with your friends and colleagues. See you in the next article.

Happy Reading!

Click to rate this post!
[Total: 8 Average: 5]