Polar subscription ended notifications on your phone.

Get a push notification when a Polar subscription really ends and the customer loses access, whether it ran out after a cancellation or payment retries failed.

subscription.revokedPayments & billingSubscriptions
How it works

Three steps to your first push

STEP 01

Install the recipe

One click in Studio gives you a personal webhook URL.

STEP 02

Paste your URL into Polar

Add it as a webhook for subscription.revoked.

STEP 03

Get a push on your phone

With the text, sound and buttons from the recipe.

Setup

How to set up the Polar subscription.revoked webhook

  1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL.
  2. In the Polar dashboard, open Settings > Webhooks and click Add Endpoint.
  3. Paste your webhook URL as the URL and leave the format on Raw.https://••••••••/•••••••• your personal URL, shown after install
  4. Generate a secret (JustPush doesn't need it), tick the subscription.revoked event and save.
  5. Tick **subscription.revoked**. This is the real end of a subscription, when the customer loses access: at the end of the period after a cancellation, straight away on an immediate revocation, or when payment retries run out. Pair it with the *Subscription canceled* recipe to hear about the cancellation itself.
  6. A subscription that ended because payment failed (status `unpaid`) gets a louder **💸 Subscription ended: unpaid** push.
  7. Testing in the **sandbox**? Add `?sandbox=1` to the URL so the button opens the sandbox dashboard.
  8. Polar signs every delivery (`webhook-id`, `webhook-timestamp`, `webhook-signature`; Standard Webhooks for secrets made on or after 8 September 2026), but JustPush doesn't check that signature yet, so keep your endpoint URL private.
The code

What runs when the webhook arrives

Studio calls handleRequest(request) with the incoming webhook and sends the message it returns. It's yours after install; change anything.

transform.js
1// Polar → subscription.revoked
2// Fires when a subscription really ends and the customer loses access: at the end of the
3// period after a cancellation, straight away on an immediate revocation, or when payment
4// retries run out (status "unpaid").
5// Docs: https://polar.sh/docs/api-reference/current/subscription_revoked
6
7// Polar amounts are in the currency's smallest unit (cents), except zero-decimal currencies.
8const ZERO_DECIMAL = new Set([
9 "bif", "clp", "djf", "gnf", "jpy", "kmf", "krw", "mga",
10 "pyg", "rwf", "ugx", "vnd", "vuv", "xaf", "xof", "xpf",
11])
12
13function money(amount, currency) {
14 if (typeof amount !== "number" || !Number.isFinite(amount) || typeof currency !== "string" || !currency) return null
15
16 const code = currency.toLowerCase()
17 const value = ZERO_DECIMAL.has(code) ? amount : amount / 100
18
19 try {
20 return new Intl.NumberFormat("en-GB", { style: "currency", currency: code.toUpperCase() }).format(value)
21 } catch {
22 return `${value} ${code.toUpperCase()}`
23 }
24}
25
26// "€19.00/month", or "€49.00 every 3 months".
27const INTERVALS = { day: "day", week: "week", month: "month", year: "year" }
28
29function price(sub) {
30 const amount = money(sub.amount, sub.currency)
31 const unit = pick(INTERVALS, sub.recurring_interval, null)
32
33 if (!amount) return null
34 if (!unit) return amount
35
36 const count = Number.isInteger(sub.recurring_interval_count) ? sub.recurring_interval_count : 1
37 return count > 1 ? `${amount} every ${count} ${unit}s` : `${amount}/${unit}`
38}
39
40// "29 Oct 2026" from an ISO timestamp, or null.
41function day(value) {
42 const date = typeof value === "string" ? new Date(value) : null
43 return date && !Number.isNaN(date.getTime())
44 ? date.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric", timeZone: "UTC" })
45 : null
46}
47
48// Table lookup that ignores inherited names such as "toString".
49function pick(table, key, fallback) {
50 return typeof key === "string" && Object.prototype.hasOwnProperty.call(table, key) ? table[key] : fallback
51}
52
53// Only link to real http(s) URLs.
54function link(url, cta) {
55 return typeof url === "string" && /^https?:\/\//.test(url) ? [{ cta, url }] : []
56}
57
58// A non-empty string, or null.
59function text(value) {
60 return typeof value === "string" && value.trim() ? value.trim() : null
61}
62
63function flag(query, name) {
64 return ["1", "true", "yes"].includes(String(query?.[name] ?? "").toLowerCase())
65}
66
67// "Jane Doe's Pro plan (€19.00/month)"
68function describe(sub) {
69 const who = text(sub.customer?.name) ?? text(sub.customer?.billing_name) ?? text(sub.customer?.email)
70 const product = text(sub.product?.name) ?? "subscription"
71 const cost = price(sub)
72
73 return (who ? `${who}'s ${product}` : `A ${product}`) + (cost ? ` (${cost})` : "")
74}
75
76function dashboard(request, sub) {
77 // ?sandbox=1 points the button at the sandbox dashboard.
78 const host = flag(request.query, "sandbox") ? "https://sandbox.polar.sh" : "https://polar.sh"
79 return link(`${host}/to/dashboard/sales/subscriptions/${encodeURIComponent(sub.id)}`, "View subscription")
80}
81
82function handleRequest(request) {
83 const body = request.body && typeof request.body === "object" ? request.body : {}
84 const sub = body.data
85
86 // Guard: only subscription.revoked, so other Polar events on this integration stay quiet.
87 if (body.type !== "subscription.revoked" || !sub || typeof sub !== "object" || !sub.id) {
88 console.log(`Ignoring Polar "${typeof body.type === "string" ? body.type : "unknown"}" event`)
89 return null
90 }
91
92 // Payment retries ran out: that's lost revenue rather than a planned cancellation.
93 const unpaid = sub.status === "unpaid"
94
95 return {
96 title: unpaid ? "💸 Subscription ended: unpaid" : "🚪 Subscription ended",
97 message: unpaid
98 ? `${describe(sub)} ended after the payment retries ran out. Access was revoked.`
99 : `${describe(sub)} has ended. Access was revoked.`,
100 topic: "Polar",
101 priority: unpaid ? 0 : -1, // Normal when payment failed, Low for a cancellation that ran out as planned
102 buttons: dashboard(request, sub),
103 }
104}
Payload

The Polar subscription.revoked webhook

This is what Polar sends to your URL for subscription.revoked. It is a sample, trimmed to the fields recipes use.

subscription.revoked · sample.json
1{
2 "data": {
3 "id": "s1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
4 "amount": 1900,
5 "status": "canceled",
6 "ends_at": "2026-09-29T08:00:00.000000Z",
7 "product": {
8 "id": "p2a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
9 "name": "Pro plan",
10 "description": null,
11 "is_archived": false,
12 "is_recurring": true,
13 "organization_id": "o1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
14 "recurring_interval": "month",
15 "recurring_interval_count": 1
16 },
17 "currency": "eur",
18 "customer": {
19 "id": "c1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
20 "name": "Jane Doe",
21 "type": "individual",
22 "email": "[email protected]",
23 "billing_name": "Jane Doe",
24 "email_verified": true,
25 "organization_id": "o1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b"
26 },
27 "discount": null,
28 "ended_at": "2026-09-29T08:00:00.000000Z",
29 "metadata": [],
30 "trial_end": null,
31 "created_at": "2026-06-29T08:00:00.000000Z",
32 "product_id": "p2a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
33 "started_at": "2026-06-29T08:00:00.000000Z",
34 "canceled_at": "2026-09-02T14:12:00.000000Z",
35 "checkout_id": null,
36 "customer_id": "c1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
37 "discount_id": null,
38 "modified_at": "2026-09-29T08:06:40.000000Z",
39 "past_due_at": null,
40 "trial_start": null,
41 "current_period_end": "2026-09-29T08:00:00.000000Z",
42 "recurring_interval": "month",
43 "cancel_at_period_end": true,
44 "current_period_start": "2026-08-29T08:00:00.000000Z",
45 "recurring_interval_count": 1,
46 "customer_cancellation_reason": "unused",
47 "customer_cancellation_comment": null
48 },
49 "type": "subscription.revoked",
50 "timestamp": "2026-09-29T08:06:40.000000Z"
51}
FAQ

Polar subscription ended notifications: questions

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 Polar 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.

Ready when you are

Polar on your phone in two minutes.

Install the recipe, paste one URL, done. Free for 30 days, no credit card required.