# Lemon Squeezy subscription cancelled notifications on your phone > Get a push notification when a Lemon Squeezy subscription is cancelled, with the date access ends. - Company: Lemon Squeezy (https://www.justpush.io/recipes/lemonsqueezy) - Event: `subscription_cancelled` (subscription_cancelled) - Tags: Finance, Subscriptions - Install: https://studio.justpush.io/recipes/lemonsqueezy/subscription-cancelled - Web page: https://www.justpush.io/recipes/lemonsqueezy/subscription-cancelled ## Setup 1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL. 2. In Lemon Squeezy, go to Settings > Webhooks and add a webhook. 3. Paste your webhook URL (shown in Studio after install) as the callback URL, enter a signing secret, and tick subscription_cancelled. 4. Save. Test mode and live mode have separate webhooks. 5. Add a webhook under **Settings → Webhooks** with the URL above and tick `subscription_cancelled`. A cancelled subscription stays active until the end of the period. 6. Lemon Squeezy signs deliveries with `X-Signature` (HMAC-SHA256 of your signing secret), but JustPush doesn't check it yet, so keep your endpoint URL private. ## Code Studio calls `handleRequest(request)` with the incoming webhook (`{ method, headers, body, query, raw }`) and sends the message object it returns. Returning `null` sends nothing. ```js // Lemon Squeezy → subscription cancelled // Fires when a subscription is cancelled. It stays active until ends_at. // Docs: https://docs.lemonsqueezy.com/help/webhooks/event-types // "12 Oct" from an ISO timestamp. function day(iso) { const date = new Date(iso) return Number.isNaN(date.getTime()) ? null : date.toLocaleDateString("en-GB", { day: "numeric", month: "short", timeZone: "UTC" }) } // The event name comes in the X-Event-Name header and in meta.event_name. // Header names can arrive in any case. function header(request, name) { const headers = request.headers || {} const key = Object.keys(headers).find((k) => k.toLowerCase() === name) const value = key ? headers[key] : null return Array.isArray(value) ? value[0] : value } // Lemon Squeezy puts test_mode in meta on real deliveries and in the attributes in its examples. function testMode(body) { return (body.meta?.test_mode ?? body.data?.attributes?.test_mode) === true ? " (test mode)" : "" } // Only link to real http(s) URLs. function link(url, cta) { return typeof url === "string" && /^https?:\/\//.test(url) ? [{ cta, url }] : [] } function handleRequest(request) { const body = request.body || {} const event = header(request, "x-event-name") ?? body.meta?.event_name const order = body.data?.attributes ?? {} // Guard: only subscription_cancelled events. if (event !== "subscription_cancelled") { console.log(`Ignoring Lemon Squeezy "${event ?? "unknown"}" event`) return null } const sub = order const until = sub.ends_at && day(sub.ends_at) ? `. Access until ${day(sub.ends_at)}.` : "" return { title: "👋 Subscription cancelled", message: [sub.user_name, sub.product_name].filter(Boolean).join(" — ") + until + testMode(body) || "A subscription was cancelled", topic: "Lemon Squeezy", priority: 0, // Normal — worth knowing; they keep access until the period ends } } ``` ## Lemon Squeezy subscription_cancelled webhook payload (sample) ```json { "data": { "id": "33445", "type": "subscriptions", "attributes": { "status": "cancelled", "ends_at": "2026-10-13T09:45:53.000000Z", "cancelled": true, "renews_at": "2026-10-13T09:45:53.000000Z", "test_mode": false, "user_name": "Jane Doe", "user_email": "jane@example.com", "product_name": "Acme Pro", "variant_name": "Monthly", "trial_ends_at": null, "status_formatted": "Cancelled" } }, "meta": { "test_mode": false, "event_name": "subscription_cancelled", "webhook_id": "a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d" } } ``` ## FAQ ### Does this work on iPhone and Android? Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification. ### Do I need to write code? No. Install the recipe in Studio, paste your webhook URL into Lemon Squeezy and you are done. The code is there if you want to change the text, the sound or the buttons. ### Can I change what the notification says? Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save. ### What does it cost? JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.