Re: Address Cannot Be Any Of The Domains using shopify-api-php

Address Cannot Be Any Of The Domains using shopify-api-php

tomerof
Shopify Partner
4 0 0

I'm trying to create a webhook using shopify-api-php.

this is the code (brackets are placeholders for the example)

Registry::register(
            [sync.myurl.com]/api/orders/paid,
            Topics::ORDERS_PAID,
            '[my-shop].myshopify.com',
            [apiAccessToken]
        )

and getting this error message

Address cannot be in domains \'shopify.com\', \'myshopify.com\', or \'shopifypreview.com\'

my path url dosen't include any of those domains so why i'm getting this error?

I'm using api version 

2023-04
Replies 3 (3)

Liam
Community Manager
3106 339 870

Hi Tomerof,

 

The error message you're seeing usually indicates that Shopify is seeing a URL that includes 'shopify.com', 'myshopify.com', or 'shopifypreview.com' as the callback URL for the webhook.

 

Looking at your code, the third parameter for the `register()` method should be the access token, not the shopify domain. The error could be due to this incorrect parameter.

 

Here is how you should structure your call:

```
Registry::register(
'https://sync.myurl.com/api/orders/paid',
Topics::ORDERS_PAID,
'[apiAccessToken]'
)
```

Make sure to replace `'https://sync.myurl.com/api/orders/paid'` with your real webhook URL and `'[apiAccessToken]'` with your real access token.

 

Also, ensure that the URL you're registering is correctly formatted and publicly accessible, as Shopify will send a POST request to this URL when the event occurs.

 

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

tomerof
Shopify Partner
4 0 0

Are you sure ?
this is the register function:

tomerof_0-1691064486086.png

first parameter $path

second $topic

third $shop (shop url ?)

forth $accessToken

 

those are the classes namespaces

tomerof_1-1691064644437.png

I'm using this git repository: https://github.com/Shopify/shopify-api-php/blob/main/docs/usage/webhooks.md#load-your-handlers

tomerof
Shopify Partner
4 0 0

Any solution ?