Gumroad refund issued notifications on your phone.

Get a low-priority push notification when a Gumroad sale 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 Gumroad

Add it as a webhook for refund.

STEP 03

Get a push on your phone

With the text, sound and buttons from the recipe.

Setup

How to set up the Gumroad refund 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 Gumroad, open Settings > Advanced.
  3. For sales, paste your webhook URL into Ping endpoint and save. For other events, subscribe it to the refund resource with the API call in the setup notes.https://••••••••/•••••••• your personal URL, shown after install
  4. Gumroad doesn't sign pings, so keep the URL private.
  5. Gumroad's **Ping endpoint** setting only covers sales. For `refund` pings, subscribe the URL through Gumroad's API:
  6. In Gumroad, open **Settings → Advanced → Applications**, create an application (any name, and any https URL such as `https://example.com` as the redirect URI), then click **Generate access token**.
  7. Run this, with your token in place of `YOUR_ACCESS_TOKEN`:
  8. ```
  9. curl https://api.gumroad.com/v2/resource_subscriptions \
  10. -d "access_token=YOUR_ACCESS_TOKEN" \
  11. -d "resource_name=refund" \
  12. --data-urlencode "post_url=your webhook URL" \
  13. -X PUT
  14. ```
  15. Refunds you issue from Gumroad, refunds made at the payment processor and partial refunds all ping. The ping carries the original sale price, not the refunded amount.
  16. Pings only arrive while the application and its access token exist, so don't delete or revoke them. Gumroad sends them form-encoded, retries a failed delivery a few times and can deliver the same event twice.
  17. Gumroad doesn't sign pings, 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// Gumroad → refund (resource subscription)
2// Fires when a sale is fully or partially refunded, by you, Gumroad or the payment processor.
3// Docs: https://gumroad.com/api#resource-subscriptions
4//
5// Gumroad POSTs form-encoded fields such as product_name=…, price=4900, refunded=true.
6// Depending on how the body was parsed, it can arrive as a nested object, a flat object
7// with bracket keys, or only as the raw string. Every value is a string ("true", "4900").
8
9const TOPIC = "Gumroad"
10
11// Keys that must never become object properties.
12const UNSAFE = new Set(["__proto__", "constructor", "prototype"])
13
14// Put a value at a bracket path such as card[visual] or purchase_ids[].
15function setPath(target, key, value) {
16 const list = /\[\]$/.test(key)
17 const parts = String(key).replace(/\[\]$/, "").replace(/\]/g, "").split("[")
18 if (parts.some((p) => p === "" || UNSAFE.has(p))) return
19 let node = target
20 for (const part of parts.slice(0, -1)) {
21 if (!Object.prototype.hasOwnProperty.call(node, part) || !node[part] || typeof node[part] !== "object" || Array.isArray(node[part])) node[part] = {}
22 node = node[part]
23 }
24 const last = parts[parts.length - 1]
25 if (!list) node[last] = value
26 else if (Array.isArray(node[last]) && Object.prototype.hasOwnProperty.call(node, last)) node[last].push(value)
27 else node[last] = [value]
28}
29
30// Decode one form-encoded piece; a bad escape shouldn't break the whole body.
31function decode(value) {
32 try {
33 return decodeURIComponent(String(value).replace(/\+/g, " "))
34 } catch {
35 return String(value)
36 }
37}
38
39// Turn whatever Studio gives us (object, JSON string or raw form string) into one object.
40function readForm(request) {
41 let body = request.body
42 if (typeof body === "string" && body.trim().startsWith("{")) {
43 try {
44 body = JSON.parse(body)
45 } catch {
46 body = null
47 }
48 }
49 const out = {}
50 if (body && typeof body === "object" && !Array.isArray(body)) {
51 for (const [key, value] of Object.entries(body)) {
52 if (key.includes("[")) setPath(out, key, value)
53 else if (!UNSAFE.has(key)) out[key] = value
54 }
55 if (Object.keys(out).length) return out
56 }
57 // Fall back to the raw form-encoded string.
58 const raw = typeof body === "string" ? body : typeof request.raw === "string" ? request.raw : ""
59 for (const pair of raw.split("&")) {
60 if (!pair) continue
61 const at = pair.indexOf("=")
62 setPath(out, decode(at < 0 ? pair : pair.slice(0, at)), at < 0 ? "" : decode(pair.slice(at + 1)))
63 }
64 return out
65}
66
67// Read an own field only, so names like "toString" never resolve to something inherited.
68function field(form, key) {
69 return Object.prototype.hasOwnProperty.call(form, key) ? form[key] : undefined
70}
71
72// Form fields are strings; treat blanks as missing.
73function text(value) {
74 if (typeof value === "number" && Number.isFinite(value)) return String(value)
75 return typeof value === "string" && value.trim() ? value.trim() : null
76}
77
78// Booleans arrive as "true"/"false" in form bodies and as true/false in JSON.
79function flag(value) {
80 return value === true || value === "true"
81}
82
83// Gumroad's price is always in USD cents, whatever the product's currency field says.
84function usd(cents) {
85 const n = typeof cents === "number" ? cents : /^-?\d+(\.\d+)?$/.test(text(cents) ?? "") ? Number(cents) : NaN
86 if (!Number.isFinite(n)) return null
87 try {
88 return new Intl.NumberFormat("en-GB", { style: "currency", currency: "USD" }).format(n / 100)
89 } catch {
90 return `US$${(n / 100).toFixed(2)}`
91 }
92}
93
94// Only link to real http(s) URLs.
95function link(url, cta) {
96 return typeof url === "string" && /^https?:\/\//.test(url) ? [{ cta, url }] : []
97}
98
99function handleRequest(request) {
100 const form = readForm(request)
101 const resource = text(field(form, "resource_name"))
102
103 // Guard: only refund pings. They look like sale pings, so resource_name decides.
104 if (resource !== "refund") {
105 console.log(`Ignoring Gumroad "${resource ?? "unknown"}" ping`)
106 return null
107 }
108
109 // refunded=true means fully refunded; a partial refund pings with refunded=false.
110 const partial = field(form, "refunded") === false || field(form, "refunded") === "false"
111 // The ping carries the original sale price (USD cents), not the refunded amount.
112 const amount = usd(field(form, "price"))
113 const who = text(field(form, "full_name")) ?? text(field(form, "email")) ?? "a customer"
114 const product = text(field(form, "product_name")) ?? "a product"
115
116 return {
117 title: partial ? "↩️ Partial refund" : "↩️ Refund issued",
118 message:
119 (partial ? `Part of ${amount ? `a ${amount} sale` : "a sale"} refunded` : `${amount ?? "A sale"} refunded`) +
120 ` to ${who} — ${product}` +
121 (flag(field(form, "test")) ? " (test)" : ""),
122 topic: TOPIC,
123 priority: -1, // Low — you (or Gumroad support) most likely issued it
124 buttons: link("https://app.gumroad.com/customers", "View sales"),
125 }
126}
Payload

The Gumroad refund webhook

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

refund · sample.json
1{
2 "card": {
3 "type": "visa",
4 "visual": "**** **** **** 4242"
5 },
6 "email": "[email protected]",
7 "price": "4900",
8 "sale_id": "yN3kP8sQ1wR5tU7vX9zA2g==",
9 "currency": "usd",
10 "disputed": "false",
11 "quantity": "1",
12 "referrer": "direct",
13 "refunded": "true",
14 "full_name": "Jane Doe",
15 "permalink": "acme-course",
16 "seller_id": "x7Q2kL0vT1aB7cD3eF5gHw==",
17 "ip_country": "Netherlands",
18 "product_id": "Qm9vc3RlclRlc3QxMjM0NQ==",
19 "can_contact": "true",
20 "dispute_won": "false",
21 "gumroad_fee": "540",
22 "order_number": "524980123",
23 "product_name": "Acme Design Course",
24 "purchaser_id": "1234567890123",
25 "resource_name": "refund",
26 "sale_timestamp": "2026-09-29T09:45:53Z",
27 "short_product_id": "qzxbt",
28 "product_permalink": "https://acme.gumroad.com/l/acme-course",
29 "discover_fee_charged": "false",
30 "is_gift_receiver_purchase": "false"
31}
FAQ

Gumroad refund issued 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 Gumroad 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

Gumroad on your phone in two minutes.

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