Polar subscription past due notifications on your phone.

Get a High-priority push notification when a Polar subscription renewal payment fails and the subscription goes past due.

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

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.past_due 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.past_due event and save.
  5. Tick **subscription.past_due**. It fires when a renewal payment fails. That's recoverable: Polar retries, and the customer can update their payment method in the customer portal. If the retries run out, Polar sends `subscription.revoked` with status `unpaid` (see the *Subscription ended* recipe).
  6. Testing in the **sandbox**? Add `?sandbox=1` to the URL so the button opens the sandbox dashboard.
  7. 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.past_due
2// Fires when a subscription renewal payment fails and the subscription goes past due. Polar
3// retries the payment and the customer can update their payment method; if the retries run out,
4// subscription.revoked follows.
5// Docs: https://polar.sh/docs/api-reference/current/subscription_past_due
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.past_due, so other Polar events on this integration stay quiet.
87 if (body.type !== "subscription.past_due" || !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 return {
93 title: "⚠️ Subscription payment failed",
94 message: `${describe(sub)} couldn't be renewed and is past due. Polar will retry the payment.`,
95 topic: "Polar",
96 priority: 1, // High: revenue at risk, and you may want to reach out
97 buttons: dashboard(request, sub),
98 }
99}
Payload

The Polar subscription.past_due webhook

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

subscription.past_due · sample.json
1{
2 "data": {
3 "id": "s1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
4 "amount": 1900,
5 "status": "past_due",
6 "ends_at": null,
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": null,
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": null,
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": "2026-09-29T08:06:40.000000Z",
40 "trial_start": null,
41 "current_period_end": "2026-10-29T08:00:00.000000Z",
42 "recurring_interval": "month",
43 "cancel_at_period_end": false,
44 "current_period_start": "2026-09-29T08:00:00.000000Z",
45 "recurring_interval_count": 1,
46 "customer_cancellation_reason": null,
47 "customer_cancellation_comment": null
48 },
49 "type": "subscription.past_due",
50 "timestamp": "2026-09-29T08:06:40.000000Z"
51}
FAQ

Polar subscription past due 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.