# Paddle subscription canceled notifications on your phone

> Get a push notification when a Paddle subscription is canceled.

- Company: Paddle (https://www.justpush.io/recipes/paddle)
- Event: `subscription.canceled` (subscription.canceled)
- Tags: Finance, Subscriptions
- Install: https://studio.justpush.io/recipes/paddle/subscription-canceled
- Web page: https://www.justpush.io/recipes/paddle/subscription-canceled

## 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 Paddle, go to Developer tools > Notifications and click New destination.
3. Choose Webhook as the type and paste your webhook URL (shown in Studio after install) as the URL.
4. Select the subscription.canceled event and save the destination.
5. The **View customer** button opens the live Paddle dashboard. Paddle doesn't say in the event whether it came from sandbox or live, so if you're testing in sandbox, change `DASHBOARD` at the top of the code to `https://sandbox-vendors.paddle.com`.
6. Paddle signs each webhook with a `Paddle-Signature` header, but JustPush doesn't verify it yet. 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
// Paddle → subscription canceled
// Fires when a subscription is canceled.
// Docs: https://developer.paddle.com/webhooks/overview
//
// Paste this into a JustPush Studio integration and add a Paddle notification destination
// for the "subscription.canceled" event pointing at the integration's endpoint URL.

// Paddle amounts are strings in the currency's smallest unit ("4900" = €49.00),
// except for zero-decimal currencies such as JPY, where "500" means ¥500.
const ZERO_DECIMAL = new Set(["jpy", "krw"])

function money(amount, currency) {
    const units = Number(amount)

    // Don't invent a figure when the event doesn't carry one.
    if (amount == null || amount === "" || !Number.isFinite(units) || !currency) return null

    const code = String(currency).toLowerCase()
    const value = ZERO_DECIMAL.has(code) ? units : units / 100

    try {
        return new Intl.NumberFormat("en-GB", { style: "currency", currency: code }).format(value)
    } catch {
        return `${value} ${code.toUpperCase()}`
    }
}

// Paddle events don't say whether they came from sandbox or live, so set this yourself.
// Sandbox: "https://sandbox-vendors.paddle.com"
const DASHBOARD = "https://vendors.paddle.com"

// Describe the first subscription item, e.g. "AeroEdit Pro — €30.00/month".
function plan(subscription) {
    const items = subscription.items ?? []
    const item = items[0]
    const price = item?.price

    if (!price) return null

    const name = item.product?.name ?? price.name
    const cycle = price.billing_cycle ?? subscription.billing_cycle
    const every = !cycle
        ? ""
        : cycle.frequency > 1
          ? ` every ${cycle.frequency} ${cycle.interval}s`
          : `/${cycle.interval}`
    const each = money(Number(price.unit_price?.amount) * (item.quantity ?? 1), price.unit_price?.currency_code)
    const cost = each ? each + every : null
    const more = items.length > 1 ? ` + ${items.length - 1} more` : ""

    return [name, cost].filter(Boolean).join(" — ") + more || null
}

function handleRequest(request) {
    const event = request.body

    // Guard: only handle this event type, so other Paddle events on this integration stay quiet.
    if (!event?.data || event.event_type !== "subscription.canceled") {
        console.log(`Ignoring Paddle event "${event?.event_type ?? "unknown"}"`)
        return null
    }

    const subscription = event.data

    return {
        title: "👋 Subscription canceled",
        message: plan(subscription) ?? "A subscription was canceled",
        topic: "Paddle",
        priority: 0, // Normal — worth knowing, nothing to fix right now
        buttons: [{ cta: "View customer", url: `${DASHBOARD}/customers-v2/${subscription.customer_id}` }],
    }
}
```

## Paddle subscription.canceled webhook payload (sample)

```json
{
  "data": {
    "id": "sub_01jpro",
    "items": [
      {
        "price": {
          "id": "pri_01jmonthly",
          "name": "Monthly",
          "product_id": "pro_01jaeroedit",
          "unit_price": {
            "amount": "3000",
            "currency_code": "EUR"
          },
          "description": "Monthly",
          "billing_cycle": {
            "interval": "month",
            "frequency": 1
          }
        },
        "status": "active",
        "product": {
          "id": "pro_01jaeroedit",
          "name": "AeroEdit Pro",
          "status": "active"
        },
        "quantity": 1,
        "recurring": true,
        "trial_dates": null
      }
    ],
    "status": "canceled",
    "canceled_at": "2026-09-28T09:30:00.000000Z",
    "customer_id": "ctm_01jjane",
    "billing_cycle": {
      "interval": "month",
      "frequency": 1
    },
    "currency_code": "EUR"
  },
  "event_id": "evt_01jsubscriptioncanceled",
  "event_type": "subscription.canceled",
  "occurred_at": "2026-09-28T09:30:00.000000Z",
  "notification_id": "ntf_01jsubscriptioncanceled"
}
```

## 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 Paddle 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.
