Re: problem connecting fulfillment API with Shopify

problem connecting fulfillment API with Shopify

Steambox
Tourist
11 0 2

Hi all,

A developer is helping us out with creating the API for our fulfillment center in Europe. They can receive all new incoming orders. However when they send out the following input to Shopify, nothing happens in our backoffice (no orders are fulfilled, no tracking codes are added automatically etc.):

{ "fulfillment" :
{ "id" : "U230000141",
"order_id" : "5073130488061",
"notify_customer" : "true",
"location_id" : "LocationId",
"shipment_status" : "ready_for_pickup",
"status" : "success",
"tracking_company" : "FOXGLOBAL",
"tracking_numbers" :
[ "05212061882145" ],
"tracking_urls" :
[ ],
"Line_items" :
[
{ "id" : "12793786728701" } ] } }


Is there someone who knows what we are doing wrong and what we should change to make this work automatically for us? Hopefully someone can help us out!

 

*btw, this is the address we are sending the above input to:

{ "fulfillment" :
{ "id" : "U230000141",
"order_id" : "5073130488061",
"notify_customer" : "true",
"location_id" : "LocationId",
"shipment_status" : "ready_for_pickup",
"status" : "success",
"tracking_company" : "FOXGLOBAL",
"tracking_numbers" :
[ "05212061882145" ],
"tracking_urls" :
[ ],
"Line_items" :
[
{ "id" : "12793786728701" } ] } }

 

Replies 6 (6)

Moira
Shopify Staff
2118 230 336

Hey @Steambox,

 

It seems that the issue might be with the specific order_id and location_id values that you are sending. Make sure that the order_id and location_id values match with the existing data in your Shopify store. Also check if the tracking_company and tracking_numbers you're providing are correct.

 

Additionally, it's worth double-checking that the API endpoint you are sending the request to is correct and that the API is properly configured to handle the request.

 

You can also check the Shopify admin panel to see if there are any error messages or notifications related to the fulfillment update request you are sending.

 

It's also possible that you need to authenticate your API requests with a valid token or API key. You should check the Shopify API documentation to see if this is required and if you have provided the correct credentials.

Moira | Social Care @ 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 the Shopify Help Center or the Shopify Blog

Steambox
Tourist
11 0 2
Hi there,

Could you let me know what te recommended API endpoint should be so that we will receive all the information which has been sent through the API:)? Also, what would be the recommended rights to give our partner? We now have the following:

read_assigned_fulfillment_orders, write_assigned_fulfillment_orders, read_fulfillments, write_fulfillments, write_locations, read_locations, write_orders, read_orders, read_products, write_third_party_fulfillment_orders, read_third_party_fulfillment_orders, read_inventory, write_inventory, write_merchant_managed_fulfillment_orders, read_merchant_managed_fulfillment_orders
Moira
Shopify Staff
2118 230 336

@Steambox 

 

The recommended API endpoint for updating a fulfillment in Shopify is the /admin/orders/{order_id}/fulfillments/{id}.json endpoint, where {order_id} is the id of the order that the fulfillment is associated with and {id} is the id of the fulfillment. This endpoint should be used to update the status of a fulfillment as well as to add tracking information.

 

In terms of the rights to give your partner, the permissions you have listed should be sufficient for them to update fulfillments on your behalf:

 

The write_assigned_fulfillment_orders permission allows them to create and update fulfillments on orders that are assigned to them.

write_fulfillments permission allows them to create and update any fulfillment. write_locations, read_locations permission allows them to access and manage the locations for the fulfillment.

write_orders read_orders permission allows them to access and manage the order. read_products, read_inventory, write_inventory permission allows them to read products and inventory information.

write_third_party_fulfillment_orders, read_third_party_fulfillment_orders permission allow them to create, update and read third-party fulfillments. write_merchant_managed_fulfillment_orders, read_merchant_managed_fulfillment_orders permission allows them to create, update and read merchant-managed fulfillments.

 

It's important to be mindful of the rights you give to third parties and to ensure that the access they have is only for the purpose of fulfilling the order and not for any other actions.

Moira | Social Care @ 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 the Shopify Help Center or the Shopify Blog

Steambox
Tourist
11 0 2
Hi Moira,

Thank you so much for your reply and the detailed explanation:)!

Could you give me an example of what your API endpoint should receive to put everything in the right direction regarding the input? For example, could you tell me how a {order_id} looks like and an {id} looks like? Is the following information correct? So should the “id” be a U23… number (10 characters) and the “order_id” a 507… (13 characters)? Is there any other information which is missing in the text or looks wrong?


{ "fulfillment" :
{ "id" : "U230000141",
"order_id" : "5073130488061",
"notify_customer" : "true",
"location_id" : "LocationId",
"shipment_status" : "ready_for_pickup",
"status" : "success",
"tracking_company" : "FOXGLOBAL",
"tracking_numbers" :
[ "05212061882145" ],
"tracking_urls" :
[ ],
"Line_items" :
[
{ "id" : "12793786728701" } ] } }

Hopefully you can help us out here, since we have a big problem now with all new orders:(...

Moira
Shopify Staff
2118 230 336

@Steambox,

 

The example you provided is mostly correct, but there are a few points to note:

 

  • The id field in the input refers to the id of the fulfillment, not the order id. This id should be unique and generated by your fulfillment center system. It should be alphanumeric and can be 10 characters as you said.
  • The order_id field should be the id of the order that the fulfillment is associated with. This id is generated by Shopify and is 13 characters as you mentioned.
  • The location_id field should be the id of the location where the fulfillment is being shipped from. This id should match an existing location id in your Shopify store.
  • The notify_customer field should be a boolean value (either "true" or "false"). If set to "true", Shopify will notify the customer that their order has been fulfilled.
  • The shipment_status field should be one of the following values: "pending", "success", "failure", "error".
  • The tracking_urls field should be an array of URLs that provide tracking information for the fulfillment. If no URLs are provided, this field should be an empty array.
  • The Line_items field should be an array of line items that are included in the fulfillment. Each line item should have an id field that corresponds to the id of the line item in the order.

 

Here is an example of what the input might look like:

 

{
  "fulfillment": {
    "id": "U230000141",
    "order_id": "5073130488061",
    "notify_customer": true,
    "location_id": "gid://shopify/Location/12345678",
    "shipment_status": "success",
    "tracking_company": "FOXGLOBAL",
    "tracking_numbers": [
      "05212061882145"
    ],
    "tracking_urls": [
      "https://foxglobal.com/tracking/05212061882145"
    ],
    "line_items": [
      {
        "id": "12793786728701"
      }
    ]
  }
}

 

It's important to note that the above input is an example, and the exact format and fields may vary depending on your specific use case. It's always recommended to check the Shopify API documentation for the most up-to-date information. Also, make sure that you are sending the request to the correct endpoint and that you have the proper authentication in place.

Moira | Social Care @ 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 the Shopify Help Center or the Shopify Blog

Steambox
Tourist
11 0 2
Hi there,

Could you please assist me and tell me exactly how we can send information to Shopify and tell Shopify that an order is fulfilled (with the right tracking information). You can find the current information attached. Are we doing something wrong or do we need to change a setting in our account? Please advice!