From email receipt to API order details

MCW
New Member
4 0 0

Is it possible to discern the Order ID from an email receipt from a Shopify merchant? I'm trying to work out how to use the API if I only have the email receipt.

Thanks,

M

Replies 6 (6)
Jordan
Shopify Staff
Shopify Staff
300 3 74

Hey there,

I wouldn't use the email receipt to retrieve an order ID since the notification can be customized to not include an order ID, or order name for that matter. Your best bet would be to subscribe to order/create webhooks to ensure order data integrity. 

However, if you can trust that the email receipt will not be customized, you can use the {{ id }} liquid variable as the identifier for order ID. 

- Jordan

Jordan | Developer Support @ 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

MCW
New Member
4 0 0

Hi Jordan,

Thank you very much! If I understand correctly this allows me to see/retrieve the order if I am the merchant. If I am the client how do I use the order ID and the merchant URL to view my order through the API?

Thanks,

M

Jordan
Shopify Staff
Shopify Staff
300 3 74

Hey M,

That's right. If you're the api client, you can use the order ID in a GET request like:

GET /admin/orders/#{order_id}.json

You can read more about it here.

 

- Jordan

Jordan | Developer Support @ 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

MCW
New Member
4 0 0

Hi Jordan,

But in this scenario I am the consumer / buyer, am I able to view the order then using the Shopify API?

Thanks,

M

Jordan
Shopify Staff
Shopify Staff
300 3 74

Hey M,

Customers don't have access to the Shopify API. They would need be registered as an api_client (i.e an app installed on the merchants shop) in order to make authenticated requests to the Shopify API. 

- Jordan

Jordan | Developer Support @ 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

MCW
New Member
4 0 0

Thanks Jordan.

M