Uninstalling the addon
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 token
will be marked as invalid, and no newAPI access tokens
can be requested. API calls will be rejected. - We will send an e-mail to the e-shop operator notifying them of the uninstallation. If this option 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.
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 → Links → API Partner → Addons tab -> click on 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 using HTTP status code 200
. Otherwise, we will retry the notification after 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 currently does not have access to these logs.
The system’s uninstall webhook supports the same webhook signing mechanism using a signature key. If the e-shop has generated a signature key, the webhook request will include the header Shoptet-Webhook-Signature
.
Pausing/resuming the add-ons
In rare cases, an OAuth Access Token
can be paused, which is a condition where the add-on remains installed and billing continues, but API requests are rejected.
Here you can find more information about pausing/resuming the add-ons.