Solved

How to get ID or shop when a FULFILLMENT_REQUEST notification is sent

JoesIdeas
Shopify Expert
2266 207 600

According to this: https://shopify.dev/apps/fulfillment/fulfillment-service-apps/manage-fulfillments-as-a-service-app, when a store makes a fulfillment request, your app (as the fulfillment service) receives a notification with a parameter "kind" being either FULFILLMENT_REQUEST or CANCELLATION_REQUEST.

 

Is there any way to get an ID?

- Fulfillment order ID

- or Order ID

- or Shop handle

 

From that guide, it sounds like every time someone requests fulfillment, Shopify wants you to make an API call to every single user to see if they have open fulfillment orders.

 

I figure I must be missing something because this is wasting thousands of API calls, but from the documentation I can't find anything.

 

Could anyone tell me how to get the rest of the data for those fulfillment requests?

 

Thanks

• Creator of Order Automator (automate tagging, fulfillment, Amazon, notifications + more)
• Shopify developer for 10+ years, store owner for 7 years
• I also make guides like Shopify Automation Tips and How to Deal with Fraud / Chargebacks
Accepted Solution (1)

SB_90
Shopify Partner
216 52 69

This is an accepted solution.

Hi @JoesIdeas 

 

Is there anything in the received headers that might give you that information - as opposed to it being in the body of the notification?

 

I don't know if that's the case or not - it was just my first hunch.

 

I agree that it would seem ridiculous to have to query every authed store to see if they had a fulfilment.

 

Perhaps there's some kind of token/HMAC validation that you can verify against your own data to get the store name?

 

View solution in original post

Replies 2 (2)

SB_90
Shopify Partner
216 52 69

This is an accepted solution.

Hi @JoesIdeas 

 

Is there anything in the received headers that might give you that information - as opposed to it being in the body of the notification?

 

I don't know if that's the case or not - it was just my first hunch.

 

I agree that it would seem ridiculous to have to query every authed store to see if they had a fulfilment.

 

Perhaps there's some kind of token/HMAC validation that you can verify against your own data to get the store name?

 

JoesIdeas
Shopify Expert
2266 207 600

Oh nice one, ya I found a field ["HTTP_X_SHOPIFY_SHOP_DOMAIN"], good idea... I didn't expect that because on normal webhooks they give the data in the hook.

 

Thanks!

• Creator of Order Automator (automate tagging, fulfillment, Amazon, notifications + more)
• Shopify developer for 10+ years, store owner for 7 years
• I also make guides like Shopify Automation Tips and How to Deal with Fraud / Chargebacks