Receiving fulfillment requests on a Fulfillment Service

golivaz
New Member
3 0 0

Hi everyone, I'm trying the fulfillment flow for a custom Fulfillment Service following the tutorial on Manage fulfillments with Fulfillment and FulfillmentOrder resources.

I have setup my Fulfillment Service with a callback_url and from the shop admin UI, I manually request fulfillment for a fulfillment order. At this point, the server is receiving a POST request to callback_url/fulfillment_order_notification with just one param ({"kind":"FULFILLMENT_REQUEST"}). It is undocumented what this callback should return to ACCEPT or  ACKNOWLEDGE the fulfillment request. I've tried to return HTTP status 200 or 202 but the fulfillment order always ends up in the following status:

 

 

"status": "OPEN",
"requestStatus": "SUBMITTED",
"supportedActions": [{ "action": "CANCEL_FULFILLMENT_ORDER" }]

 

 

This situation is documented in the tutorial:

 

For fulfillment orders that return CANCEL_FULFILLMENT_ORDER as a supported action, it is recommended to call the fulfillmentOrderCancel mutation. Fulfillment orders that return this supported action have a requestStatus of SUBMITTED or CANCELLATION_REQUESTED.

If a fulfillmentOrder has a requestStatus of SUBMITTED, then a request for fulfillment has been sent to the third-party fulfillment service, but it has not been acknowledged. Calling FulfillmentOrderCancel cancels the fulfillmentOrder immediately since the fulfillment service has not yet accepted the fulfillment request

So at this point, the only option is to cancel the fulfillment order and a new one is created.

What I would really want is to be able to accept the request, by using the fulfillmentOrderAcceptFulfillmentRequest GraphQL mutation, for example, or reject it.

 

So my question is: what should the callback respond so the fulfillment order request can be later accepted or rejected?

 

Thanks in advance.

0 Likes
_JB
Shopify Staff
Shopify Staff
750 87 165

Hey @golivaz,

 

Can you kindly send along an example of an order_id or fulfillement_order_id where you've seen this behaviour after responding to the callback? Your logic here seems sound so I'm thinking this might be related to access scope or something specific to your test environment. If you provide those ids I can take a look and confirm, in the meantime you can double-check your requested scopes and make sure you have the appropriate fulfillment_order scope for the type of product you're trying to fulfill ( merchant_managed_fulfillment_orders and/or  third_party_fulfillment_orders and/or assigned_fulfillment_orders).

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
golivaz
New Member
3 0 0

Hi JB, thanks for the support.

Here is an example: gid://shopify/FulfillmentOrder/1405350805584

What I see, while debugging, is that before the callback actually responds, the fulfillment order is already only accepting "CANCEL_FULFILLMENT_ORDER" action.

 

About the app scopes, I have all that you mention except read/write "merchant_managed_fulfillment_orders". But after adding it, nothing changed.

 

Thanks!

0 Likes
golivaz
New Member
3 0 0

Hello @_JB, did you have the chance to look into it? Thanks!

0 Likes