I’m looking for an unambiguous, permanent way to uniquely identify a merchant using my app. For example, in my hosting environment add such a unique identification to database keys.
I have read that using the “xxx.myshopify.com” domain fits this purpose - I’m looking to confirm that or learn of a better way.
I do this GraphQL query for a merchant:
query shop {
shop {
name
domains {
host
id
url
}
url
id
}
}
and see a result of
{
"data": {
"shop": {
"name": "Cool Company",
"domains": [
{
"host": "cool-company-co.myshopify.com",
"id": "gid://shopify/Domain/85799333767",
"url": "https://cool-company-co.myshopify.com"
},
{
"host": "www.coolcompany.com",
"id": "gid://shopify/Domain/86271236143",
"url": "https://www.coolcompany.com"
},
{
"host": "coolcompany.com",
"id": "gid://shopify/Domain/86279321911",
"url": "https://coolcompany.com"
}
],
"url": "https://www.coolcompany.com",
"id": "gid://shopify/Shop/58093905679"
}
},
So… is the accepted method to iterate through the domains and pick the one that ends in “myshopify.com” and use that forever as the unique ID?
Or is there a simpler way to just get a unique, permanent ID?
Also, in the query result above what is the last ID shown (58093905679)? It seems to be at the shop level and is different than the other domains. Is this a candidate for a unique, permanent ID?
Thanks for any guidance.