Error: "This action requires merchant approval for write_orders scope" on Fulfillment

Highlighted
New Member
11 0 0

Hello,

We are building an API integration from Salesforce, which stores all of our inventory, with our new Shopify store. Customers, Products, and Orders are syncing smoothly, however I get an error when trying to populate Fulfillment info from Salesforce (which is integrated with our shipping providers) into an Order in Shopify.

Error: 403 - "This action requires merchant approval for write_orders scope." however the private App grants Read and Write access to "Orders, transactions and fulfillments".

What else do I need to change?

Thank you

0 Likes
Shopify Partner
857 6 142

Hi Brian Oconnell

  1. Using GraphQL Admin API or REST Admin API
  2. Can you provide a little more context as to what you're POST-ing? What status is the Order in?
  3. Are you testing on a dev store?

A sample POST stripped of sensitive data would be ideal.

I turn coffee in to code - since 1998
0 Likes
New Member
11 0 0

Hi Karl, thanks for responding.

We are using Admin REST API in a Production environment.  We did not have any permissions issues in a dev environment. The Order status is "Unfulfilled" and Payment Status is "Paid".

Creation of Fulfillment Using REST Admin API For Order (OrderId : 1021757390906) :

Authentication : We are using API Key and API Secret for Authentication.
EndPointUrl: https://storewpd.myshopify.com/admin/orders/1021757390906//fulfillments.json
Method: “POST”
Header: “'application/json”
Body :
When shipment method is “Fedex” 
{
  "fulfillment": {
    "tracking_company": “Fedex”,
    "tracking_number": "123456",
    "tracking_urls": [     "https://www.fedex.com/apps/fedextrack/?tracknumbers='Opportunity.Shipment_Tracking_Number__c" ]
   
  }
}

When shipment method is “USPS” 
{
  "fulfillment": {
    "tracking_company": “USPS”,
    "tracking_number": "123456",
    "tracking_urls": [     "https://tools.usps.com/go/TrackConfirmAction?tLabels='+oppObj.Shipment_Tracking_Number__c" ]
     }
}

When shipment method is “UPS” 
{
  "fulfillment": {
    "tracking_company": “UPS”,
    "tracking_number": "123456",
    "tracking_urls": [     "https://www.ups.com/track?loc=en_US&tracknum='Opportunity.Shipment_Tracking_Number__c" ]
     }
}

 

0 Likes
Shopify Partner
857 6 142

Okay, unless you left out some fields in those payloads, I see the following error::Since multi-location fulfillments were introduced, you have to provide a location_id

So taking your Fedex example should be:

{
  "fulfillment": {
    "location_id": 123456789,
    "tracking_company": "Fedex",
    "tracking_number": "123456",
    "tracking_urls": ["https://www.fedex.com/apps/fedextrack/?tracknumbers='Opportunity.Shipment_Tracking_Number__c"]
   
  }
}

Hope that solves the issue although I cannot verify leaving out the location_id would throw that weird unrelated error (not on my dev machine now)

Best wishes!

I turn coffee in to code - since 1998
0 Likes
Shopify Partner
857 6 142

Ah, missed the part where you mention it works on dev, not in prod. Hmm, out of ideas.

Anyone @Shopify?

I turn coffee in to code - since 1998
0 Likes
New Member
11 0 0

My team of developers and I have tried with the location_id and we still get the same permission error: "[API] This action requires merchant approval for write_orders scope."

 

How do I as the merchant grant this approval to myself?

0 Likes
New Member
11 0 0

Just to verify that I do have write_orders access:

 

curl https://xxxx:xxxx@gemma-by-wp-diamonds.myshopify.com/admin/oauth/access_scopes.json
{"access_scopes":[{"handle":"read_analytics"},{"handle":"write_customers"},{"handle":"write_draft_orders"},{"handle":"write_fulfillments"},{"handle":"write_inventory"},{"handle":"read_locations"},{"handle":"read_marketing_events"},{"handle":"write_orders"},{"handle":"write_price_rules"},{"handle":"write_product_listings"},{"handle":"write_products"},{"handle":"write_shipping"},{"handle":"read_shopify_payments_payouts"},{"handle":"read_all_orders"},{"handle":"read_customers"},{"handle":"read_draft_orders"},{"handle":"read_fulfillments"},{"handle":"read_inventory"},{"handle":"read_orders"},{"handle":"read_price_rules"},{"handle":"read_product_listings"},{"handle":"read_products"},{"handle":"read_shipping"}]}

0 Likes