Polar order refunded notifications on your phone.

Get a low-priority push notification when a Polar order is fully or partially refunded.

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 order.refunded.

STEP 03

Get a push on your phone

With the text, sound and buttons from the recipe.

Setup

How to set up the Polar order.refunded 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 order.refunded event and save.
  5. Tick **order.refunded**. It fires for full and partial refunds and carries the whole order, so the push can name the customer and product. (`refund.created` fires for every refund whatever its status, and without the customer's name, so this recipe doesn't use it.)
  6. The amount is the total refunded on the order so far, including tax. A second partial refund on the same order shows the new running total.
  7. Testing in the **sandbox**? Add `?sandbox=1` to the URL so the button opens the sandbox dashboard.
  8. 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 → order.refunded
2// Fires when an order is fully or partially refunded.
3// Docs: https://polar.sh/docs/api-reference/current/order_refunded
4//
5// Polar keeps refunds as running totals on the order: refunded_amount (before tax) plus
6// refunded_tax_amount. The push shows the total refunded so far.
7
8// Polar amounts are in the currency's smallest unit (cents), except zero-decimal currencies.
9const ZERO_DECIMAL = new Set([
10 "bif", "clp", "djf", "gnf", "jpy", "kmf", "krw", "mga",
11 "pyg", "rwf", "ugx", "vnd", "vuv", "xaf", "xof", "xpf",
12])
13
14function money(amount, currency) {
15 if (typeof amount !== "number" || !Number.isFinite(amount) || typeof currency !== "string" || !currency) return null
16
17 const code = currency.toLowerCase()
18 const value = ZERO_DECIMAL.has(code) ? amount : amount / 100
19
20 try {
21 return new Intl.NumberFormat("en-GB", { style: "currency", currency: code.toUpperCase() }).format(value)
22 } catch {
23 return `${value} ${code.toUpperCase()}`
24 }
25}
26
27// Only link to real http(s) URLs.
28function link(url, cta) {
29 return typeof url === "string" && /^https?:\/\//.test(url) ? [{ cta, url }] : []
30}
31
32// A non-empty string, or null.
33function text(value) {
34 return typeof value === "string" && value.trim() ? value.trim() : null
35}
36
37function flag(query, name) {
38 return ["1", "true", "yes"].includes(String(query?.[name] ?? "").toLowerCase())
39}
40
41function handleRequest(request) {
42 const body = request.body && typeof request.body === "object" ? request.body : {}
43 const order = body.data
44
45 // Guard: only order.refunded, so other Polar events on this integration stay quiet.
46 if (body.type !== "order.refunded" || !order || typeof order !== "object" || !order.id) {
47 console.log(`Ignoring Polar "${typeof body.type === "string" ? body.type : "unknown"}" event`)
48 return null
49 }
50
51 const net = typeof order.refunded_amount === "number" ? order.refunded_amount : null
52 const tax = typeof order.refunded_tax_amount === "number" ? order.refunded_tax_amount : 0
53 const refunded = net === null ? null : money(net + tax, order.currency)
54 const total = money(order.total_amount, order.currency)
55 const partial = order.status === "partially_refunded"
56 const who = text(order.customer?.name) ?? text(order.billing_name) ?? text(order.customer?.email)
57 const product = text(order.product?.name) ?? text(order.description)
58 // ?sandbox=1 points the button at the sandbox dashboard.
59 const host = flag(request.query, "sandbox") ? "https://sandbox.polar.sh" : "https://polar.sh"
60
61 return {
62 title: partial ? "↩️ Partial refund" : "↩️ Order refunded",
63 message:
64 (refunded ? `${refunded} refunded` : "Refund issued") +
65 (partial && total ? ` of ${total}` : "") +
66 (who ? ` to ${who}` : "") +
67 (product ? ` · ${product}` : ""),
68 topic: "Polar",
69 priority: -1, // Low: you (or a teammate) most likely issued it yourself
70 buttons: link(`${host}/to/dashboard/sales/${encodeURIComponent(order.id)}`, "View order"),
71 }
72}
Payload

The Polar order.refunded webhook

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

order.refunded · sample.json
1{
2 "data": {
3 "id": "7e3a5c1d-2b4f-4c8e-9a1b-0f2d3e4c5b6a",
4 "paid": true,
5 "items": [
6 {
7 "label": "Lifetime licence",
8 "amount": 4900,
9 "proration": false,
10 "tax_amount": 1029
11 }
12 ],
13 "status": "partially_refunded",
14 "product": {
15 "id": "p1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
16 "name": "Lifetime licence",
17 "description": null,
18 "is_archived": false,
19 "is_recurring": false,
20 "organization_id": "o1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
21 "recurring_interval": null
22 },
23 "currency": "eur",
24 "customer": {
25 "id": "c1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
26 "name": "Jane Doe",
27 "type": "individual",
28 "email": "[email protected]",
29 "billing_name": "Jane Doe",
30 "email_verified": true,
31 "organization_id": "o1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b"
32 },
33 "metadata": [],
34 "created_at": "2026-09-29T08:06:30.000000Z",
35 "due_amount": 0,
36 "net_amount": 4900,
37 "product_id": "p1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
38 "tax_amount": 1029,
39 "checkout_id": "k1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
40 "customer_id": "c1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
41 "description": "Lifetime licence",
42 "discount_id": null,
43 "modified_at": "2026-09-29T10:15:00.000000Z",
44 "billing_name": "Jane Doe",
45 "subscription": null,
46 "total_amount": 5929,
47 "billing_reason": "purchase",
48 "invoice_number": "ACME-0042",
49 "discount_amount": 0,
50 "refunded_amount": 2000,
51 "subscription_id": null,
52 "subtotal_amount": 4900,
53 "refunded_tax_amount": 420,
54 "applied_balance_amount": 0
55 },
56 "type": "order.refunded",
57 "timestamp": "2026-09-29T10:15:00.000000Z"
58}
FAQ

Polar order refunded 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.