I am having a similar problem to this post:
Basically my cancel order functionality is no longer working. I post the /V1/orders/{id}/cancel and it returns only "false". We don't process a lot of cancellations but this was working when we built it 2 years ago.
The order is paid for and in the processing state if that helps.
If cancelling will not work is there a logical equivalent like refunding and closing the order? If so what are the API steps required? For example, call the Refund API at XX and then call the close order API at XXYY.
Thanks a bunch
Solved! Go to Solution.
Hi @stacy1712
For refund You can use below rest API:
url : http://<base_url>/rest/V1/invoice/{invoiceId}/refund
Method : POST
Token: Admin token
request: { "items": [ { "extension_attributes": {}, "order_item_id": 0, "qty": 0 } ], "isOnline": true, "notify": true, "appendComment": true, "comment": { "extension_attributes": {}, "comment": "string", "is_visible_on_front": 0 }, "arguments": { "shipping_amount": 0, "adjustment_positive": 0, "adjustment_negative": 0, "extension_attributes": { "return_to_stock_items": [ 0 ] } } }
For cancel order:
Method: POST
Token: Admin token
URL :
http://<base_url>/rest/V1/orders/<order_entity_id>/cancel
response : true
If issue resolve, please click on 'Kudos' & Accept as Solution!
Hi @stacy1712
For refund You can use below rest API:
url : http://<base_url>/rest/V1/invoice/{invoiceId}/refund
Method : POST
Token: Admin token
request: { "items": [ { "extension_attributes": {}, "order_item_id": 0, "qty": 0 } ], "isOnline": true, "notify": true, "appendComment": true, "comment": { "extension_attributes": {}, "comment": "string", "is_visible_on_front": 0 }, "arguments": { "shipping_amount": 0, "adjustment_positive": 0, "adjustment_negative": 0, "extension_attributes": { "return_to_stock_items": [ 0 ] } } }
For cancel order:
Method: POST
Token: Admin token
URL :
http://<base_url>/rest/V1/orders/<order_entity_id>/cancel
response : true
If issue resolve, please click on 'Kudos' & Accept as Solution!
So once an order reaches a certain state it can no longer be canceled and must be refunded?
It might be a good idea to make this issue a top search result for "canceling an order through Magento 2 API." I have seen countless results that either has no answer or just general confusion on the topic. Usually with a very robotic response that although correct does not answer the question someone was asking.
@Bhanu Periwal wrote:Hi @stacy1712 happy wheels
For refund You can use below rest API:url : http://<base_url>/rest/V1/invoice/{invoiceId}/refund
Method : POST
Token: Admin tokenrequest: { "items": [ { "extension_attributes": {}, "order_item_id": 0, "qty": 0 } ], "isOnline": true, "notify": true, "appendComment": true, "comment": { "extension_attributes": {}, "comment": "string", "is_visible_on_front": 0 }, "arguments": { "shipping_amount": 0, "adjustment_positive": 0, "adjustment_negative": 0, "extension_attributes": { "return_to_stock_items": [ 0 ] } } }For cancel order:
Method: POST
Token: Admin token
URL :http://<base_url>/rest/V1/orders/<order_entity_id>/cancelresponse : true
If issue resolve, please click on 'Kudos' & Accept as Solution!
Thanks guys. It was helpful
@Bhanu Periwal wrote:Hi @stacy1712 basketballlegends fun
For refund You can use below rest API:url : http://<base_url>/rest/V1/invoice/{invoiceId}/refund
Method : POST
Token: Admin tokenrequest: { "items": [ { "extension_attributes": {}, "order_item_id": 0, "qty": 0 } ], "isOnline": true, "notify": true, "appendComment": true, "comment": { "extension_attributes": {}, "comment": "string", "is_visible_on_front": 0 }, "arguments": { "shipping_amount": 0, "adjustment_positive": 0, "adjustment_negative": 0, "extension_attributes": { "return_to_stock_items": [ 0 ] } } }For cancel order:
Method: POST
Token: Admin token
URL :http://<base_url>/rest/V1/orders/<order_entity_id>/cancelresponse : true
If issue resolve, please click on 'Kudos' & Accept as Solution!
Your answer will really help a lot, such answers and topics are always needed, thank you.
Magento 2 Cancel Order by Meetanshi allows customers to cancel their pending order from the storefront.The competition in E-commerce business is all about offering the best customer experience. For Magento 2 stores, Meetanshi's Magento 2 Cancel Order extension helps in improving the shopping experience of the store.
With Magento 2 Cancel Order by Customer extension, let customers cancel their pending orders from "My Account", "My Orders" and order details page in the frontend. The admin is notified via an automated Email about the order cancelation.
The Magento 2 Cancel Order extension also lets customers add comments in the confirmation popup that can be seen from the backend. It gives useful data to the admin for improving the products' features and understanding the customers' mindset!
Benefits of Magento 2 Cancel Order:
For more information, visit https://meetanshi.com/magento-2-cancel-order.html
Moments before the horrific, blasphemous death of flash, the java script version of Happy Wheels has arrived. That was close. Sorry for the delay. Hopefully the fear of losing Happy Wheels did not prevent your restful sleep. If you didn't even know it was in development, then here is your exciting news. happy wheels
You can use this extension for Cancel order, Order Cancel extension provides users an option to cancel their order from front-end. The extension is developed to help customers to cancel orders within a customisable time frame by logging into their account section on website.
The following link Magento 2 Cancel Order would be useful.