RevenueCat subscription expired notifications on your phone.

Get a low-priority push notification when a subscription expires and the customer loses access, with the reason.

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 RevenueCat

Add it as a webhook for EXPIRATION.

STEP 03

Get a push on your phone

With the text, sound and buttons from the recipe.

Setup

How to set up the RevenueCat expiration 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 RevenueCat dashboard, open your project's Integrations > Webhooks and add a new webhook.
  3. Paste your webhook URL as the webhook URL.https://••••••••/•••••••• your personal URL, shown after install
  4. Send all events, or only EXPIRATION; the recipe ignores every other event type.
  5. Save, then click Send test event to confirm it arrives.
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// RevenueCat → EXPIRATION
2// Fires when a subscription expires and the customer loses access.
3// Docs: https://www.revenuecat.com/docs/integrations/webhooks/event-types-and-fields
4//
5// Paste this into a JustPush Studio integration and add a RevenueCat webhook pointing
6// at the integration's endpoint URL.
7
8// Human-readable store names.
9const STORES = {
10 APP_STORE: "App Store",
11 MAC_APP_STORE: "Mac App Store",
12 PLAY_STORE: "Google Play",
13 AMAZON: "Amazon",
14 STRIPE: "Stripe",
15 PADDLE: "Paddle",
16 RC_BILLING: "Web Billing",
17 ROKU: "Roku",
18 PROMOTIONAL: "a promotional grant",
19 TEST_STORE: "Test Store",
20}
21
22// RevenueCat prices are decimals ("9.99"), not cents. Returns null when there's no price.
23function money(amount, currency) {
24 const value = Number(amount)
25
26 if (amount == null || !Number.isFinite(value) || !currency) return null
27
28 try {
29 return new Intl.NumberFormat("en-GB", { style: "currency", currency }).format(value)
30 } catch {
31 return `${value} ${currency}`
32 }
33}
34
35// Turn "NL" into 🇳🇱.
36function flag(countryCode) {
37 return /^[A-Z]{2}$/.test(countryCode ?? "")
38 ? String.fromCodePoint(...[...countryCode].map((c) => 127397 + c.charCodeAt(0)))
39 : ""
40}
41
42// "pro_monthly on App Store from [email protected] 🇳🇱 (sandbox)"
43function where(event) {
44 const attributes = event.subscriber_attributes ?? {}
45 const who = attributes.$email?.value ?? attributes.$displayName?.value
46 const store = STORES[event.store] ?? event.store
47
48 return (
49 (event.product_id ?? "a product") +
50 (store ? ` on ${store}` : "") +
51 (who ? ` from ${who}` : "") +
52 (flag(event.country_code) ? ` ${flag(event.country_code)}` : "") +
53 (event.environment === "SANDBOX" ? " (sandbox)" : "")
54 )
55}
56
57// Why a subscription ended, in words.
58const REASONS = {
59 UNSUBSCRIBE: "turned off auto-renew",
60 BILLING_ERROR: "payment failed",
61 DEVELOPER_INITIATED: "canceled by you",
62 PRICE_INCREASE: "didn't accept a price increase",
63 CUSTOMER_SUPPORT: "refunded",
64 SUBSCRIPTION_PAUSED: "paused",
65}
66
67function handleRequest(request) {
68 const event = (request.body || {}).event
69
70 // "Send test event" in RevenueCat; confirm the connection with a quiet push.
71 if (event?.type === "TEST") {
72 return { title: "🔔 RevenueCat connected", message: "Test event received", topic: "RevenueCat", priority: -1 }
73 }
74
75 // Guard: only handle this event type, so other RevenueCat events on this integration stay quiet.
76 if (event?.type !== "EXPIRATION") {
77 console.log(`Ignoring RevenueCat event "${event?.type ?? "unknown"}"`)
78 return null
79 }
80
81 const reason = REASONS[event.expiration_reason]
82
83 return {
84 title: "⌛ Subscription expired",
85 message: where(event) + (reason ? ` — ${reason}` : ""),
86 topic: "RevenueCat",
87 priority: -1, // Low — you already heard about the cancellation or billing issue
88 }
89}
Payload

The RevenueCat EXPIRATION webhook

This is what RevenueCat sends to your URL for expiration. It is a sample, trimmed to the fields recipes use.

EXPIRATION · sample.json
1{
2 "event": {
3 "id": "CD489E0E-EXPIRATI",
4 "type": "EXPIRATION",
5 "price": 0,
6 "store": "APP_STORE",
7 "app_id": "app1a2b3c4d5",
8 "aliases": [
9 "user_8Hq2"
10 ],
11 "currency": "EUR",
12 "product_id": "pro_monthly",
13 "app_user_id": "user_8Hq2",
14 "environment": "PRODUCTION",
15 "period_type": "NORMAL",
16 "country_code": "NL",
17 "transaction_id": "2000000712345678",
18 "entitlement_ids": [
19 "pro"
20 ],
21 "purchased_at_ms": 1790584200000,
22 "expiration_at_ms": 1793176200000,
23 "expiration_reason": "BILLING_ERROR",
24 "event_timestamp_ms": 1790584200000,
25 "subscriber_attributes": {
26 "$email": {
27 "value": "[email protected]",
28 "updated_at_ms": 1790584100000
29 }
30 },
31 "original_transaction_id": "2000000612345678",
32 "price_in_purchased_currency": 0
33 },
34 "api_version": "1.0"
35}
FAQ

RevenueCat subscription expired 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 RevenueCat 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

RevenueCat on your phone in two minutes.

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