Uninstalling the addon
The user may choose to stop using the addon and uninstall it in the e-shop administration. Alternatively, the e-shop may be terminated, and the uninstallation will be completed along with the e-shop termination.
As a developer, you can recognize this in three ways:
- The
OAuth access tokenwill be marked as invalid, and no newAPI access tokenscan be requested. API calls will be rejected. - We send you an email about the uninstallation (if Send email notifications is enabled in the addon settings).
- Through an uninstallation webhook (see below for details).
You may need to deactivate the user (e-shop) in your system in response to the uninstallation, to avoid making API calls with an invalid token.
Also, be aware that the e-shop operator may change their mind and reinstall the addon. Without proper handling, this could lead to problems with duplicate accounts during the second installation.
When the addon is uninstalled, Shoptet also deletes all webhooks your addon registered for that e-shop through the API. If the e-shop installs the addon again, register them again as part of the new installation.
Uninstaller webhook
You may have encountered webhooks on a separate page dedicated to the e-shop’s webhooks. The concept of the uninstaller webhook is the same. Its purpose is to call the URL you registered using the HTTPS protocol when the addon is uninstalled from a particular e-shop.
If you choose to use the uninstaller webhook, you must first register the URL that will receive notifications about addon uninstallations. In the addon settings (Partner e-shop administration → Connections → API Partner → Addons tab → click the addon name), enter the webhook URL to receive the uninstallation notification, e.g.: https://myapplication.tld/uninstall.php
From that point on, whenever any e-shop uninstalls your addon or is terminated, Shoptet will invoke the URL https://myapplication.tld/uninstall.php via a POST request 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), the event type (addon:uninstall), the time of creation, and the instance concerned (eventInstance) – which is the e-shop identifier again (e.g., 222651).
The data is sent in the body of the request in JSON format. So, for example, in PHP, you can retrieve and convert it into 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 acknowledged by the webhook with an HTTP 2xx status code within 4 seconds. Redirects are not followed — a 3xx response counts as a failed delivery. Otherwise, we will retry the notification within 15 minutes, up to two more times (for a total of three attempts). If the final attempt is not acknowledged, the notification will be marked as inactive, and Shoptet will no longer make further delivery attempts.
Delivered notifications are logged internally by Shoptet, but the addon author does not have access to these logs: GET /api/webhooks/notifications lists only notifications of webhooks registered through the API, not system webhooks such as the uninstall webhook.
The uninstall webhook supports the same signing mechanism as other webhooks. If a signature key has been generated for the e-shop, the webhook request includes the Shoptet-Webhook-Signature header.
Pausing and resuming addons
In rare cases, an OAuth access token can be paused: the addon remains installed and billing continues, but API requests are rejected.
For more information, see Pausing and resuming addons.