Cancel Fulfillment API returns HTTP 422 in version 2020-01

Tourist
6 1 1

Hi,

 

I'm making the same cancel fulfillment request for the same order id and fulfillment id, it is successful in version 2019-10 but it fails with HTTP/1.1 422 Unprocessable Entity in version 2020-01.

 

The error message I got is 

{"errors":"An error occurred, please try again"}

There is no difference between my API calls, I'm only changing the version number.

I'm using this endpoint

POST /admin/api/2020-01/orders/#{order_id}/fulfillments/#{fulfillment_id}/cancel.json

 

Thanks in advance

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 102 127

Hey @birben ,

 

Could you please provide the value of the X-Request-ID header from the HTTP Error Status 422 API response you are receiving form Shopify? With this value we would be able to investigate and troubleshoot more about why this is happening

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Tourist
5 1 1

Hi @hassain ,

I got the same problem. Working in 2019-10, no longer for 2020-01.

 

"X-Request-Id" => array:1 [
0 => "1c2b4f16-542c-4343-bdef-c2ae9a049caa"
]

 

Thank you for looking in.

 

Best regards.

0 Likes
Highlighted
New Member
6 0 0

I also have the same problem in 2020-01.

Please see my unanswered forum post for more details:
https://community.shopify.com/c/Shopify-APIs-SDKs/Error-code-422-Unprocessable-Entity-An-error-occur...

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 102 127

Hey @JonathanEsign ,

 

Thanks for the Request-ID. Looking at the logs, it looks like your fulfillment cancellation request may have failed because the fulfillment was already cancelled in the first place.

 

@birben @JonathanEsign @dcflx ,

 

In general, it is good to point out that as of API Version 2020-01, Shopify did update how it handles fulfillments and fulfilling orders. There is a new resource introduced (FulfillmentOrders) that represents the groups of line items in an order that are fulfilled together and this resource gives you more control over managing fulfillment. There are also new access scopes your apps will need. For a detailed guide on the new workflow in API Version 2020-01, please read this guide: https://shopify.dev/tutorials/manage-fulfillments-with-fulfillment-and-fulfillmentorder-resources 

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Tourist
5 1 1

Hi @hassain 

 

Thank you for your reply.

 

My fulfillment doesn't show up cancelled in Shopify. But I might have tested the same fulfillment with the older api version.

 

Here is a new request id:

"X-Request-Id" => array:1 [
0 => "6203e858-6511-4dda-bfac-754b4b3c3689"
]

 

Are we obligated to use Fulfillmentorders?

The error message does not say why the input might be wrong, so it looks like a temporary issue?

0 Likes
Highlighted
Tourist
6 1 1

Hi all,

 

I have discussed this problem with Shopify Support (kudos to them, they are really good and friendly), our problem turned out to be related to the permissions of my app. When I gave the Merchant managed fulfillment orders permission to our app, the problem has resolved. 

 

Cheers,

Murat

1 Like
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 102 127

Hey @JonathanEsign ,

 

Thanks for the new Request-ID. I can verify that in this request the Fulfillment was not already cancelled when you tried to make the cancellation POST request.

 

In terms of why this request failed, like I and others mentioned earlier, your app is missing the permissions to work with FulfillmentOrders

 

If you are using API version 2020-01 and higher, then yes you need to update use the new workflow for handling Fulfillments+FulfillmentOrders with Multi Locations. 

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

1 Like
Highlighted
Tourist
5 1 1

Hi all

 

thanks for the responses!

Adding the permissions did the trick. 

 

Thanks a lot!

0 Likes