Skip to content
Advertisement

Delete the store details from PHP Application after uninstalling app from Shopify Store

I want the delete the store details from PHP Application after uninstalling the app from Shopify store which are stored in database when Application installed,

Now I got some solution for this like following:

$create_webhook = array('webhook'=>array( 
    'topic'=> 'app/uninstalled', 
    'address'=>'{{ mydomainname}}/uninstalled.php',
    'format'=> 'json'
));

$request_update = $shopify('POST /admin/webhooks.json ', array(), $create_webhook);

But can we create this webhook at installing time or any other time?

Advertisement

Answer

Your example code is registering a callback that will be accessed by the shopify uninstall webhook which will run when your app is uninstalled via the shopify admin UI. Make sure that “address” property is a public url to your applications uninstall callback.

Yes, you can register a callback for webhook at anytime.

When the app is uninstalled, shopify will send a POST request to the address you specified in the ‘address’ property with a json payload that has the customers details.

Take care to collect the X-Shopify-Hmac-SHA256 header and verify this is a genuine request before your callback deletes customer data.

Make sure you have all the data you need before the uninstall hook is run. Uninstall revokes account tokens, removes registered webhooks and app data from shopify.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement