Stripe subscription canceled notifications on your phone.

Get a push notification when a Stripe subscription ends, with the customer's cancellation feedback when they left any.

customer.subscription.deletedFinanceSubscriptions Signature verified
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 Stripe

Add it as a webhook for customer.subscription.deleted.

STEP 03

Get a push on your phone

With the text, sound and buttons from the recipe.

Setup

How to set up the Stripe customer.subscription.deleted 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 Stripe Dashboard, open Workbench > Webhooks and click Add destination.
  3. Select the customer.subscription.deleted event and choose Webhook endpoint.
  4. Paste your webhook URL as the endpoint URL and save.https://••••••••/•••••••• your personal URL, shown after install
  5. Reveal the signing secret (whsec_…) and copy it into JustPush.
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// Stripe → customer.subscription.deleted
2// Fires when a subscription ends (canceled immediately or at period end).
3// Docs: https://docs.stripe.com/api/events/types
4//
5// Paste this into a JustPush Studio integration and add a Stripe webhook destination
6// for the "customer.subscription.deleted" event pointing at the integration's endpoint URL.
7
8// Stripe amounts are in the currency's smallest unit (cents), except for
9// zero-decimal currencies such as JPY, where 500 means ¥500.
10const ZERO_DECIMAL = new Set([
11 "bif", "clp", "djf", "gnf", "jpy", "kmf", "krw", "mga",
12 "pyg", "rwf", "ugx", "vnd", "vuv", "xaf", "xof", "xpf",
13])
14
15function money(amount, currency) {
16 // Don't invent a figure when the event doesn't carry one.
17 if (typeof amount !== "number" || !Number.isFinite(amount) || !currency) return null
18
19 const code = String(currency).toLowerCase()
20 const value = ZERO_DECIMAL.has(code) ? amount : amount / 100
21
22 try {
23 return new Intl.NumberFormat("en-GB", { style: "currency", currency: code }).format(value)
24 } catch {
25 return `${value} ${code.toUpperCase()}`
26 }
27}
28
29// Test-mode objects live under /test in the Dashboard.
30function dashboardUrl(event, path) {
31 return `https://dashboard.stripe.com/${event.livemode ? "" : "test/"}${path}`
32}
33
34// Describe the first subscription item, e.g. "Pro — £20.00/month".
35// Stripe only sends the product ID, so the price's nickname is the best name available.
36function plan(subscription) {
37 const item = subscription.items?.data?.[0]
38 const price = item?.price
39
40 if (!price) return null
41
42 const recurring = price.recurring
43 const every = !recurring
44 ? ""
45 : recurring.interval_count > 1
46 ? ` every ${recurring.interval_count} ${recurring.interval}s`
47 : `/${recurring.interval}`
48 const each = money(price.unit_amount * (item.quantity ?? 1), price.currency)
49 const cost = each ? each + every : null
50
51 return [price.nickname, cost].filter(Boolean).join(" — ") || null
52}
53
54function handleRequest(request) {
55 const event = request.body
56
57 // Guard: only handle this event type, so other Stripe events on this integration stay quiet.
58 if (event?.object !== "event" || event.type !== "customer.subscription.deleted" || !event.data?.object) {
59 console.log(`Ignoring Stripe event "${event?.type ?? "unknown"}"`)
60 return null
61 }
62
63 const subscription = event.data.object
64 const summary = plan(subscription) ?? "A subscription"
65 const details = subscription.cancellation_details ?? {}
66 // "feedback" is what the customer picked in the cancellation flow; "reason" is how it ended.
67 const why = details.feedback ?? details.reason
68 const comment = details.comment ? ` “${details.comment}”` : ""
69
70 return {
71 title: "👋 Subscription canceled",
72 message: summary + (why ? ` — ${why.replace(/_/g, " ")}` : "") + comment,
73 topic: "Stripe",
74 priority: 0, // Normal — worth knowing, nothing to fix right now
75 buttons: [{ cta: "View customer", url: dashboardUrl(event, `customers/${subscription.customer}`) }],
76 }
77}
Payload

The Stripe customer.subscription.deleted webhook

This is what Stripe sends to your URL for customer.subscription.deleted. It is a sample, trimmed to the fields recipes use.

customer.subscription.deleted · sample.json
1{
2 "id": "evt_test_subscription_canceled",
3 "data": {
4 "object": {
5 "id": "sub_test_1Qa2Bc",
6 "items": {
7 "data": [
8 {
9 "id": "si_test_Q1a2",
10 "price": {
11 "id": "price_test_1Pro",
12 "object": "price",
13 "product": "prod_test_Pro",
14 "currency": "eur",
15 "nickname": "Pro",
16 "recurring": {
17 "interval": "month",
18 "interval_count": 1
19 },
20 "unit_amount": 2000
21 },
22 "object": "subscription_item",
23 "quantity": 1
24 }
25 ],
26 "object": "list"
27 },
28 "object": "subscription",
29 "status": "canceled",
30 "customer": "cus_test_R2d2",
31 "ended_at": 1790584100,
32 "canceled_at": 1790584100,
33 "cancellation_details": {
34 "reason": "cancellation_requested",
35 "comment": "Great product, just over budget right now.",
36 "feedback": "too_expensive"
37 }
38 }
39 },
40 "type": "customer.subscription.deleted",
41 "object": "event",
42 "created": 1790584200,
43 "livemode": false,
44 "api_version": "2025-09-30.clover"
45}
Security

How the Stripe signature is verified

Stripe-Signature

Stripe signs every webhook with a timestamped HMAC-SHA256 signature in the Stripe-Signature header, made with your endpoint's signing secret. Add the secret to the recipe in Studio and JustPush checks every request before your code runs, so requests that don't come from Stripe never reach your phone.

FAQ

Stripe subscription canceled 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 Stripe 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

Stripe on your phone in two minutes.

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