What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Order confirmation/acceptance via API

Solved

Order confirmation/acceptance via API

RamonB
Shopify Partner
1 0 1

Hi,

Background info
Via the Rest Admin API we use an IPAAS system to pick up the order from Shopify and send it to our 3PL and  ERP-system.
The  IPAAS System checks every 5min for new orders and looks 6 hours back to be sure if we got everything or if the System is offline due to any errors it still picks the order up. Before posting the order in our 3PL/ERP system it checks if the order is already in our system by using the Shopify Order id.

The problem
Sometimes we have a duplicate order in our system, because this is not a closed loop. It happens that the system can not find the correct shopify id or due some connectivity problems then the system re-create the order.
We want to solve this in Shopify aka the source of the order. I am looking for some sort of status that we can set in Shopify or a field that we can use.

Possible Solution

What we are thinking of now is creating a meta field on the order. When the IPAAS get the order from Shopify it filles this meta field with a t.b.d value. The IPAAS system should only pick up orders that have an empty or not matching value.
The downside of this is that we have to create an extra GET call because the meta field is not standard in the order call.

The question
Does any one has experience on this matter? Or a better solution?

 

Accepted Solution (1)

garyrgilbert
Shopify Partner
431 41 186

This is an accepted solution.

Hi Ramon, 

 

If its your db couldn't you just put a unique key contraint on the order id?  This would be a heck of a lot easier than updating every order you process by adding a metafield saying that you processed it, especially a metafield since unless you are querying the orders via graphql you won't get the metafields for an order in a single rest api request.  You will first have to get the orders and then for each order you want to process make another request to get the metafields.. this is way too much network traffic for very little benefit when the solution really should be on your side.

 

I would add a unique key constraint to the db table and depending on your db flavor let the error happen and ignore if the order already exists. if you don't like that, then make sure your orderid column is at least indexed and query the table before you try to insert a new order.

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

View solution in original post

Reply 1 (1)

garyrgilbert
Shopify Partner
431 41 186

This is an accepted solution.

Hi Ramon, 

 

If its your db couldn't you just put a unique key contraint on the order id?  This would be a heck of a lot easier than updating every order you process by adding a metafield saying that you processed it, especially a metafield since unless you are querying the orders via graphql you won't get the metafields for an order in a single rest api request.  You will first have to get the orders and then for each order you want to process make another request to get the metafields.. this is way too much network traffic for very little benefit when the solution really should be on your side.

 

I would add a unique key constraint to the db table and depending on your db flavor let the error happen and ignore if the order already exists. if you don't like that, then make sure your orderid column is at least indexed and query the table before you try to insert a new order.

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution