Restricted Access to Orders via API

Laupa
Tourist
4 0 1

Hi,

 

We would like to connect a new marketplace to our store via API.
We wanted to use the Admin API for this.
However, we only want the marketplace to be able to read orders via the API that have been created via the marketplace. The marketplace should not be able to read orders that were created in the online store itself.
In addition, the marketplace should only receive products from certain categories.
How can these two requirements be implemented?

 

Thanks

Replies 3 (3)

Liam
Shopify Staff
2731 299 769

Hi Laupa,

 

To restrict marketplace access to orders created specifically through the marketplace on Shopify, you could use order tagging or order metafields. By automatically tagging these orders with a unique identifier or metafield upon creation through the marketplace, you can distinguish them from orders created directly in the online store. However, the Admin API does not support direct filtering of orders by tags or metafields through query parameters. For this you'd need a server-side solution where your app fetches all orders and then filters out only those tagged or that contains the metafield before presenting them to the marketplace, ensuring the marketplace accesses only its orders.

 

Hope this helps,

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

Laupa
Tourist
4 0 1

Hi Liam,

 

thankyou so much, that's super helpful.

Could you please specify for me, what a server-side solution could be? We would somehow need to restrict the orders before the API fetches them I guess, but could you please specify on how I can implement this?

 

Thanks!

Laupa
Tourist
4 0 1

hi @Liam ,

 

can you please share some more information about this?

Could you please specify for me, what a server-side solution could be? Is there any other way to make this work?

 

Thankyou!