Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

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

Solved

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

JoesIdeas
Shopify Partner
2520 229 678

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 [auto tag, fulfill, connect FBA, daily jobs]
• Co-Creator of Product Automator [suite of features for products / collections]
• Shopify developer for 10+ years, store owner for 7 years
• Blog: Shopify Tips, Guides, and Automation Tactics
Accepted Solution (1)

SB_90
Shopify Partner
216 52 71

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 71

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 Partner
2520 229 678

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 [auto tag, fulfill, connect FBA, daily jobs]
• Co-Creator of Product Automator [suite of features for products / collections]
• Shopify developer for 10+ years, store owner for 7 years
• Blog: Shopify Tips, Guides, and Automation Tactics