I have an issue where my Shopify webhook to handle when a shop uninstalls my app is firing my uninstall route when installing the app. If I uninstall the app my uninstall route is fired as expected. I just don't understand why it fires when the app is installed.
Is there something wrong with my webhook?
This is my webhook code:
$webhook = $this->sh->call([
'URL' => 'https://'.$shop.'/admin/webhooks.json',
'METHOD' => 'POST',
'DATA' => array (
'webhook' => array (
'topic' => 'app/uninstalled',
'address' => 'https://myserver.homelinux.com/uninstall',
'format' => 'json',
)
)
], false);
I call this code when the shop has accepted the payment transaction. Immediately it requests my address
url https://myserver.homelinux.com/uninstall
My understanding is that this should register the webhook and only request this address when the shop uninstalls the app.
Any help/advice with this would be great.