Skip to main content

After an app is uninstalled

When a merchant uninstalls your app, Shoplazza immediately revokes your app's access token for that store, deletes its webhook subscriptions, and stops renewing its subscription charge. Your app learns about the uninstall from the app/uninstalled webhook, and then has three jobs: stop processing the store, delete the store's data, and be ready for the merchant to reinstall.

What Shoplazza does automatically on uninstall​

ObjectState after uninstall
Access tokenRevoked immediately. Calls to the OpenAPI with it return 401.
Webhook subscriptionsYour app's subscriptions for the store are deleted immediately; the app/uninstalled subscription is deleted once this delivery gets a non-5xx response (it is kept if 5xx retries are exhausted).
Subscription charge (RecurringCharge)An active subscription gets cancel_sub_on set: it no longer renews, and no new usage charges can be created. At the end of the current billing cycle its status becomes cancelled, and usage charges incurred up to the cancellation time are settled.
Script tagsAll script tags your app created in the store are deleted.
Theme app extensionsApp embeds stop loading on the storefront.
Checkout extensions, FunctionsInstalled checkout extensions are uninstalled; Function bindings to cart transform are removed.

Because the token is already revoked, your app can no longer call the store's OpenAPI once it receives the uninstall event. Don't design cleanup logic that depends on API calls.

Step 1: Subscribe to app/uninstalled after every install​

app/uninstalled is the only way your app learns about an uninstall. Since all subscriptions are deleted on uninstall, subscribe again after every install, as soon as OAuth returns a token — including when a merchant reinstalls.

bash
curl -X POST "https://<shop>/openapi/2022-01/webhooks" \
-H "Access-Token: <access_token>" \
-H "Content-Type: application/json" \
-d '{"topic": "app/uninstalled", "address": "https://your-app.example.com/webhooks/app-uninstalled"}'

Subscribing the same app to the same topic twice in a store returns 422 (topic already exist). Treat that response as already subscribed in your install flow, and don't keep retrying.

The request body differs by API version — from 2025-06 on it must be wrapped in a webhook object. See Webhooks overview · Register a subscription.

Step 2: Acknowledge quickly, then process per store​

The app/uninstalled body contains only the app object, with no store information. Identify the store from the X-Shoplazza-Shop-Domain request header.

Order of operations:

  1. Verify X-Shoplazza-Hmac-Sha256 with your Client Secret. See HMAC signature verification.
  2. Return 2xx within 5 seconds, and do the rest in a background job.
  3. Deduplicate on X-Shoplazza-Deduplication-ID; return 2xx for repeat deliveries.
js
app.post('/webhooks/app-uninstalled', express.raw({ type: '*/*' }), (req, res) => {
// verifyHmac: see "HMAC signature verification · Scenario 2"
if (!verifyHmac(req.body, req.get('X-Shoplazza-Hmac-Sha256'))) {
return res.sendStatus(401);
}
const shopDomain = req.get('X-Shoplazza-Shop-Domain');
const dedupId = req.get('X-Shoplazza-Deduplication-ID');
res.sendStatus(200); // acknowledge first
queue.add('app-uninstalled', { shopDomain, dedupId }); // then process async
});
There is no second chance for this delivery

Only a 5xx response triggers a retry; 4xx, timeouts, and connection failures are not retried. If your endpoint fails, you miss the uninstall for good.

Add a fallback: when an OpenAPI call for a store returns 401, treat the store as possibly uninstalled — stop calling it and flag it for review.

Step 3: Stop all processing for the store​

In the background job:

  • Mark the store as uninstalled and delete the stored access token.
  • Stop scheduled jobs, sync jobs, and queue consumers for the store.
  • Stop serving paid features. The subscription no longer renews — don't wait for the charge status to become cancelled.

Step 4: Delete store data within your stated retention period​

Shoplazza sends no further data-deletion event, so schedule the deletion yourself:

  • State in your privacy policy how long you keep data after uninstall — for example 30 days, so a merchant who reinstalls can get their settings back.
  • When the period ends, delete the store's data from your databases, caches, and backups, except what the law requires you to keep.
  • Record when the deletion happened, so you can demonstrate compliance.

See Privacy compliance.

Step 5: Support reinstalls​

When a merchant reinstalls after uninstalling, handle it as a fresh install:

  • Run OAuth again to get a new access token; the old one can't be used. See Installation and setup requirements.
  • Subscribe to webhooks again, including app/uninstalled.
  • Create a new subscription charge. The old one is cancelled, so even a reinstall within the same billing cycle needs a new subscription.
  • Recreate script tags, if your app uses them.
  • If your app uses Functions, Shoplazza rebinds them automatically, but the binding id changes — don't cache the old id. See Function extensions.

Test the uninstall flow​

Run through it end to end in a development store:

  1. Install the app and confirm the app/uninstalled subscription exists (GET /openapi/2022-01/webhooks).
  2. Uninstall the app from the store admin.
  3. Confirm your endpoint received the delivery, returned 2xx, and marked the store as uninstalled.
  4. Call any OpenAPI endpoint with the old token and confirm it returns 401.
  5. Reinstall, and confirm you get a new token and the webhooks are subscribed again.

FAQ​

Not receiving app/uninstalled? Check three things: whether you subscribed to app/uninstalled after this install; whether your endpoint returns 2xx within 5 seconds; and whether a faulty HMAC check is returning 4xx.

Can I still call the API with the old token after uninstall? No. The token is revoked immediately on uninstall, and calls return 401.

Subscribing to a webhook on reinstall returns 422? The subscription still exists — usually because the same install flow ran the subscription step twice. Treat it as subscribed.