Cancel Order API from scratch

hitshraj
Visitor
1 0 0

I want to use cancel order API but as i am new to shopify and its API call i m not able to find how and from where in shopify can i call this API . I have went through the documentation provided for the cancel order API but my doubt is as the cancel order API is an admin API , i am not able to fetch json data through POST request . I m able to fetch data when i call GET request API for order.

Reply 1 (1)

vix
Shopify Staff
540 103 121

Hi @hitshraj 

 

The steps would be the following: 

1. Find the order ID you want. Either through the API (GET) or in the admin

2. do a POST to /admin/api/2020-01/orders/#{order_id}/cancel.json where #{order_id} is replaced by the actual order ID

 

Also please see all the requirements for the order to be canceled: https://help.shopify.com/en/manual/orders/refund-cancel-order#cancel-an-order

To learn more visit the Shopify Help Center or the Community Blog.