Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
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
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
Are you sure ?
this is the register function:
first parameter $path
second $topic
third $shop (shop url ?)
forth $accessToken
those are the classes namespaces
I'm using this git repository: https://github.com/Shopify/shopify-api-php/blob/main/docs/usage/webhooks.md#load-your-handlers
Any solution ?