SEOshop Documentation

Uninstalling an app

Merchants can cancel an app monthly through their store admin; when payment is handled by Lightspeed eCom, they pay for the app on their monthly billing cycle. When merchants cancel the app - actually cancelling payment - the app shows "cancelled" and they may use the app untill the next invoicing round (they may use the app for as long as they've paid for it). With this next payment cycle, the app's token is revoked and the partner has no more access to the shop. The app will then be uninstalled and show status "expired".

When a merchant cancels his app subscription (status "cancelled"), your app will be notified about this action through a call to the cancel URL. This is convenient for retention purposes, as you know when somebody wants to quit using the app.

When the app is finally uninstalled (status "expired" - at the end of the shop's billing cycle), your app will be notified about this action through a call to the uninstall URL.

Validating the cancel or uninstall requests works the same as the install request except that there won't be a token parameter for creating the signature. After validating the signature you can delete all unnecessary data from your system. Webhooks will be deleted automatically by the platform.

NOTE: You can set the cancel URL and uninstall URL to your scripts in the partner environment together with the success URL.

Success, Cancel and Uninstall URL

Important: while testing the app, you'll need to manually call the uninstall URL because it is not yet possible to cancel the app from the App Store.

Note: If the merchant cancels the app within 12 hours after installation, the app will be uninstalled ("Expired)" immediately and the uninstallation URL will be called upon.

Note: The uninstall URL can be called by all the platforms. The request will contain the parameter cluster_id to identify from which cluster the request is coming.

Example:

<?php
// Configuration file
// --------------------------------------------------
define('APP_KEY', 'YOUR_APP_KEY');
define('APP_SECRET', 'YOUR_APP_SECRET');


// Uninstall file
// --------------------------------------------------
if (
    isset($_GET['language'])
    && isset($_GET['shop_id'])
    && isset($_GET['signature'])
    && isset($_GET['timestamp'])
) {
    // Create the signature
    $params = array(
        'language'  => $_GET['language'],
        'shop_id'   => $_GET['shop_id'],
        'timestamp' => $_GET['timestamp']
    );

    ksort($params);

    $signature = '';

    foreach ($params as $key => $value) {
        $signature .= $key . '=' . $value;
    }

    $signature = md5($signature . APP_SECRET);

    // Validate the signature
    if ($signature == $_GET['signature']) {
        // Delete the store information from the database
        mysql_query("DELETE FROM shops WHERE shop_id = '" . mysql_real_escape_string($_GET['shop_id']) . "'");
    }
}

NOTE: as for verifying the call to the cancel-URL, the delete_timestamp is also included in the signature. The params in the example above should be:

    $params = array(
        'language'         => $_GET['language'],
        'shop_id'          => $_GET['shop_id'],
        'timestamp'        => $_GET['timestamp'],
        'delete_timestamp' => $_GET['delete_timestamp']
    );
Was this article helpful? Yes No
One moment please
Thanks for your feedback.