New Shopify Certification now available: Liquid Storefronts for Theme Developers

Fulfillment Request Callback Never Fires

yinghechen
Shopify Partner
5 0 0

Hi Shopify Expert,

 

I created a fulfillment location service, and its callback never fires when user send a fulfillment request.

 

 

const fulfillmentService = {
      callback_url: "https://www.xyz.com/webhook/fulfillment_request",
      fulfillmentOrdersOptIn: true,
      inventoryManagement: true,
      name: "xyz ",
      permitsSkuSharing: true,
      trackingSupport: false,
    };
    await new Promise((resolve, reject) => {
      shopifyClient
        .query({
          data: {
            query: `	
              mutation fulfillmentServiceCreate($name: String!) {	
                fulfillmentServiceCreate(name: $name) {	
                  fulfillmentService {	
                    location {	
                      id	
                    }	
                  }	
                  userErrors {	
                    field	
                    message	
                  }	
                }	
              }           	
              `,
            variables: fulfillmentService,
          },
        })

 

 

When I make a fulfillment request on Shopify UI, my webhook "https://www.xyz.com/webhook/fulfillment_request" or "https://www.xyz.com/webhook/fulfillment_request/fulfillment_order_notification" or even "https://www.xyz.com/webhook" never received anything. Can you help ?

Replies 2 (2)
yinghechen
Shopify Partner
5 0 0

[Still need help]Some debug process:  I find that I mis-spell the 'callbackURL', However, after I put the correct URL, and read location service, the URL is still null, and optIn: false.

ShopifyDevSup
Shopify Staff
Shopify Staff
1203 190 420

Hey @yinghechen have you tried defining the variables like this? 

 

{
  "name": "example_fulfillment_service",
  "fulfillmentOrdersOptIn": true,
  "callbackUrl": "https://callback.org/"
}

 


If you're using our Node.js library to set your app up, you'd also want to set up the initial mutation like this:

const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation fulfillmentServiceCreate($name: String!, $callbackUrl: URL!, $fulfillmentOrdersOptIn: Boolean!) {
      fulfillmentServiceCreate(name: $name, callbackUrl: $callbackUrl, fulfillmentOrdersOptIn: $fulfillmentOrdersOptIn) {
        fulfillmentService {
          id
          serviceName
          callbackUrl
          fulfillmentOrdersOptIn
        }
        userErrors {
          field
          message
        }
      }
    }`,
    "variables": {
      "name": "example_fulfillment_service",
      "fulfillmentOrdersOptIn": true,
      "callbackUrl": "https://callback.org/"
    },
  },
});


My understand is that you can't implement a defined JS object within the variables of the GraphQL call itself. Hope this helps! 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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