Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

Cannot access fulfillment order

DevNic
Shopify Partner
1 0 0

I'm trying to access

https://{my-test-store}.myshopify.com/admin/api/2023-04/orders/{order_id}/fulfillment_orders.json

to move an order through the fulfillment process but I keep getting

{"errors":"The api_client does not have the required permission(s)."}

 I've added all the fulfillment authorization scopes but still giving me  this error. I can access the fulfillments array but not the fulfillment orders. The scopes I have added are:

["write_assigned_fulfillment_orders",
  "read_assigned_fulfillment_orders",
  "read_customers",
  "write_draft_orders",
  "read_draft_orders",
  "write_fulfillments",
  "read_fulfillments",
  "write_inventory",
  "read_inventory",
  "write_merchant_managed_fulfillment_orders",
  "read_merchant_managed_fulfillment_orders",
  "write_orders",
  "read_orders",
  "write_products",
  "read_products",
  "write_shipping",
  "read_shipping",
  "write_third_party_fulfillment_orders",
  "read_third_party_fulfillment_orders"]

Any ideas?

 

 

Replies 8 (8)

Michael_AG
Shopify Staff
47 8 11

Hi,

 

DM me with the fulfillment order, shop, api_client details and I'll have a look.

To learn more visit the Shopify Help Center or the Community Blog.

CLaidlaw
Shopify Partner
6 0 0

I too am having a similar issue, except my issue is with a POST to 2023-04/fulfillments.json to create a fulfillment for an order. Was there a generic solution for this, or should I send a DM to Michael_AG too?

Michael_AG
Shopify Staff
47 8 11

Hi! This is a generic access check error. 

 

Do you specify correct access token in the request headers?

X-Shopify-Access-Token: <your shpat_* access token>

 

Does you app have the correct permissions? It should be one of the `write_{assigned/merchant_managed/third_party}_fulfillment_orders`, depending on the your app role and the kind of the fulfillment order you are intending to fulfill.

 

Can you retrieve that fulfillment order with

`GET "https://your-development-store.myshopify.com/admin/api/2023-04/fulfillment_orders/<id>.json"` ?

To learn more visit the Shopify Help Center or the Community Blog.

CLaidlaw
Shopify Partner
6 0 0

I have all of the fulfillment permissions/scopes that are configurable. Much as you had written `write_{assigned/merchant_managed/third_party}_fulfillment_orders`.

 

The header `X-Shopify-Access-Token` is set on my Postman request. The app itself is a Spring Boot application and uses the Base64 encoded <key>:<pass> format for the Basic Authorization header. Both give the same 403 response.

"errors": "The api_client does not have the required permission(s)."

 

The order is unfulfilled, I am able to query `2023-04/fulfillment_orders/<fulfillment_order_id>.json` and `2023-04/orders/<order_id>/fulfillment_orders.json` and `2023-04/orders/<order_id>/fulfillments.json` successfully.

ShopifyDevSup
Shopify Staff
1244 201 440

Hi @CLaidlaw,

 

You may be encountering permission errors as stated above. You can refer to our documents on migrating to fulfillment orders and under step 1 you can get an understaffing of the scopes you will require. 

 

Also, it may be worth going over our fulfillment documents in full just to give you a greater understanding of the entire process.

 

Hope that 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

CLaidlaw
Shopify Partner
6 0 0

If so, then the scopes/permissions are either not properly configured or not being applied. I do see the scopes listed on the app settings on the store settings for the app.

 

The flow I am using is when a shipment webhook comes in from a processing system outside of the Shopify realm I use the REST API to pull the fulfillment orders for the order, then I create a fulfillment payload with the line_items_by_fulfillment_order structure with related fulfillment_order_line_items that were shipped; the tracking information is included on the fulfillment object as well to be submitted to the `2023-04/fulfillments.json` endpoint.

 

I am able to access `fulfillments` related data since I can get the empty fulfillments array from the orders endpoint `2023-04/orders/<order_id>/fulfillments.json`

 

I will take a closer look at this documentation segment.

https://shopify.dev/docs/apps/fulfillment/migrate#existing-installations

CLaidlaw
Shopify Partner
6 0 0

Not sure what happened, but I went through each write_*_fulfillment_order on the request_scope endpoint on the migration guide and all but the write_assigned_fulfillment_orders worked. Now the app is working, no scope update required on the app by the client. Either that made a difference, or it was a timing thing and now it works. Either way, thank you for you help, it is now functional.

CLaidlaw
Shopify Partner
6 0 0

I am getting the following when checking for `write_assigned_fulfillment_orders` scope

Missing required scopes: \"write_assigned_fulfillment_orders\" requires \"write_fulfillments\".

 

I have the `write_fulfillments` scope on my app scope list and it is provided to the /authorize endpoint during the OAuth installation/update. I am unable to create a fulfillment service for the app with the following response.

"errors": "[API] This action requires merchant approval for write_fulfillments scope."

 

Since the scopes have been submitted to the store and updated, what could be the next problem in this process?

 

Scopes configured on the app.

read_discounts,
write_discounts,
read_fulfillments,
write_fulfillments,
read_gift_cards,
write_gift_cards,
read_inventory,
write_inventory,
read_locations,
read_orders,
write_orders,
read_price_rules,
write_price_rules,
read_product_listings,
read_products,
read_shipping,
read_third_party_fulfillment_orders,
write_third_party_fulfillment_orders,
read_customer_payment_methods,
write_own_subscription_contracts,
read_assigned_fulfillment_orders,
write_assigned_fulfillment_orders,
read_merchant_managed_fulfillment_orders,
write_merchant_managed_fulfillment_orders,
read_all_orders