# Paddle refund created notifications on your phone

> Get a low-priority push notification when a Paddle refund is created, including whether it's still waiting for approval.

- Company: Paddle (https://www.justpush.io/recipes/paddle)
- Event: `adjustment.created` (adjustment.created)
- Tags: Finance, Payments
- Install: https://studio.justpush.io/recipes/paddle/refund-created
- Web page: https://www.justpush.io/recipes/paddle/refund-created

## 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 adjustment.created event and save the destination.
5. Refunds, credits and chargebacks all arrive as `adjustment.created`. This recipe only reacts to refunds, so you can point the chargeback recipe at the same event without double pushes.
6. The **View transaction** 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`.
7. 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 → refund created
// Fires when a refund is created (Paddle reviews most refunds before approving them).
// Docs: https://developer.paddle.com/webhooks/overview
//
// Paste this into a JustPush Studio integration and add a Paddle notification destination
// for the "adjustment.created" 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"

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

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

    // Refunds, credits and chargebacks all arrive as adjustment.created; keep refunds only.
    if (event.data.action !== "refund") {
        console.log(`Ignoring "${event.data.action}" adjustment — not a refund`)
        return null
    }

    const adjustment = event.data
    const amount = money(adjustment.totals?.total, adjustment.currency_code ?? adjustment.totals?.currency_code)
    const kind = adjustment.type === "partial" ? "Partial refund" : "Refund"
    const reason = adjustment.reason ? ` — ${adjustment.reason}` : ""
    const pending = adjustment.status === "pending_approval" ? ". Waiting for Paddle to approve." : ""

    return {
        title: "↩️ Refund created",
        message: `${kind}${amount ? ` of ${amount}` : ""}${reason}${pending}`,
        topic: "Paddle",
        priority: -1, // Low — you (or a teammate) most likely requested it yourself
        buttons: adjustment.transaction_id
            ? [{ cta: "View transaction", url: `${DASHBOARD}/transactions-v2/${adjustment.transaction_id}` }]
            : [],
    }
}
```

## Paddle adjustment.created webhook payload (sample)

```json
{
  "data": {
    "id": "adj_01jrefund",
    "type": "partial",
    "action": "refund",
    "reason": "Customer was double charged",
    "status": "pending_approval",
    "totals": {
      "fee": "75",
      "tax": "260",
      "total": "1500",
      "earnings": "1165",
      "subtotal": "1240",
      "currency_code": "EUR"
    },
    "customer_id": "ctm_01jjane",
    "currency_code": "EUR",
    "transaction_id": "txn_01jpaid",
    "subscription_id": "sub_01jpro"
  },
  "event_id": "evt_01jrefundcreated",
  "event_type": "adjustment.created",
  "occurred_at": "2026-09-28T09:30:00.000000Z",
  "notification_id": "ntf_01jrefundcreated"
}
```

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