Uninstalling the addon

The user may choose not to use the addon anymore, and uninstall it in the e-shop administration. Alternatively, the e-shop may be terminated and the uninstallation completed together with e-shop termination.

As a developer, you can recognize this in 3 ways:
1. The OAuth access token will be marked as invalid and no new API access tokens could be requested. API calls will be rejected.
2. We will send an e-mail to the e-shop operator about the uninstallation.
3. By means of an uninstallation webhook (see below for details)

You may need to deactivate the user (e-shop) in your system in response to the uninstallation, in order not to call an API with an invalid token.

Also, be aware that the e-shop operator may change his/her mind and reinstall the addon – without any processing, there might be problems with duplicate accounts during the second installation.

Uninstaller webhook

You may have met the webhooks on a separate page, dedicated to the e-shop’s webhooks. The concept of the uninstaller webhook system is the same. The goal is to call the URL you registered using a HTTPS protocol at the time the addon is uninstalled at the particular e-shop.

If you choose to use the uninstaller webhook, you must first register the URL to receive notifications about the uninstalled addon. In the addon settings (Partner e-shop administration → Links → API Partner → addons tab), fill in the webhook URL to get the uninstall notification, e.g.: https://myapplication.tld/uninstall.php

From now on, whenever any e-shop uninstalls your addon or it is terminated, Shoptet will invoke the URL, https://myapplication.tld/uninstall.php, as a POST with the following content:

    "eshopId": 222651,
    "event": "addon:uninstall",
    "eventCreated": "2019-01-08T15:13:39+0100",
    "eventInstance": "222651"

The event notification contains the e-shop identification (eshopId), event type (addon:uninstall ), time of creation, and the instance concerned (eventInstance) – which is the e-shop identity again (e.g. 222651).

The data is sent in the request’s body in JSON format. So, for example in php, you get them and convert them to an associative array as follows:

$body = file_get_contents('php://input');
$webhook = json_decode($body, TRUE);

A notification sent to a webhook URL must be confirmed by the webhook, using HTTP code 200. Otherwise we will repeat the notification after 15 minutes, twice (2) (maximum total of 3 attempts). After an unconfirmed last notification, we will mark the notification as inactive and Shoptet will no longer make further attempts to deliver it.

The delivered notifications are internally logged by Shoptet, but the addon author is currently unable to view the log.

The system’s uninstall web hook supports the same mechanism webhook signing using a signature key. If the e-hop generated a signature key, the webhook will be labeled Shoptet-Webhook-Signature.