# Gumroad new dispute notifications on your phone > Get a high-priority push notification when a buyer disputes a Gumroad sale, and a quiet one when you win it. - Company: Gumroad (https://www.justpush.io/recipes/gumroad) - Event: `dispute` (dispute) - Tags: Payments & billing, Failed payments & disputes - Install: https://studio.justpush.io/recipes/gumroad/dispute - Web page: https://www.justpush.io/recipes/gumroad/dispute ## 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 Gumroad, open Settings > Advanced. 3. For sales, paste your webhook URL (shown in Studio after install) into Ping endpoint and save. For other events, subscribe it to the dispute resource with the API call in the setup notes. 4. Gumroad doesn't sign pings, so keep the URL private. 5. Gumroad's **Ping endpoint** setting only covers sales. For `dispute` 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=dispute" \ 12. --data-urlencode "post_url=your webhook URL (shown in Studio after install)" \ 13. -X PUT 14. ``` 15. To also get a quiet **✅ Dispute won** push, run the same call again with `resource_name=dispute_won`. 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. ## 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 // Gumroad → dispute and dispute_won (resource subscriptions) // Fires when a buyer disputes a sale (chargeback) and, if you subscribe to it too, when you win it. // Docs: https://gumroad.com/api#resource-subscriptions // // Gumroad POSTs form-encoded fields such as product_name=…, price=4900, refunded=true. // Depending on how the body was parsed, it can arrive as a nested object, a flat object // with bracket keys, or only as the raw string. Every value is a string ("true", "4900"). const TOPIC = "Gumroad" // Keys that must never become object properties. const UNSAFE = new Set(["__proto__", "constructor", "prototype"]) // Put a value at a bracket path such as card[visual] or purchase_ids[]. function setPath(target, key, value) { const list = /\[\]$/.test(key) const parts = String(key).replace(/\[\]$/, "").replace(/\]/g, "").split("[") if (parts.some((p) => p === "" || UNSAFE.has(p))) return let node = target for (const part of parts.slice(0, -1)) { if (!Object.prototype.hasOwnProperty.call(node, part) || !node[part] || typeof node[part] !== "object" || Array.isArray(node[part])) node[part] = {} node = node[part] } const last = parts[parts.length - 1] if (!list) node[last] = value else if (Array.isArray(node[last]) && Object.prototype.hasOwnProperty.call(node, last)) node[last].push(value) else node[last] = [value] } // Decode one form-encoded piece; a bad escape shouldn't break the whole body. function decode(value) { try { return decodeURIComponent(String(value).replace(/\+/g, " ")) } catch { return String(value) } } // Turn whatever Studio gives us (object, JSON string or raw form string) into one object. function readForm(request) { let body = request.body if (typeof body === "string" && body.trim().startsWith("{")) { try { body = JSON.parse(body) } catch { body = null } } const out = {} if (body && typeof body === "object" && !Array.isArray(body)) { for (const [key, value] of Object.entries(body)) { if (key.includes("[")) setPath(out, key, value) else if (!UNSAFE.has(key)) out[key] = value } if (Object.keys(out).length) return out } // Fall back to the raw form-encoded string. const raw = typeof body === "string" ? body : typeof request.raw === "string" ? request.raw : "" for (const pair of raw.split("&")) { if (!pair) continue const at = pair.indexOf("=") setPath(out, decode(at < 0 ? pair : pair.slice(0, at)), at < 0 ? "" : decode(pair.slice(at + 1))) } return out } // Read an own field only, so names like "toString" never resolve to something inherited. function field(form, key) { return Object.prototype.hasOwnProperty.call(form, key) ? form[key] : undefined } // Form fields are strings; treat blanks as missing. function text(value) { if (typeof value === "number" && Number.isFinite(value)) return String(value) return typeof value === "string" && value.trim() ? value.trim() : null } // Booleans arrive as "true"/"false" in form bodies and as true/false in JSON. function flag(value) { return value === true || value === "true" } // Gumroad's price is always in USD cents, whatever the product's currency field says. function usd(cents) { const n = typeof cents === "number" ? cents : /^-?\d+(\.\d+)?$/.test(text(cents) ?? "") ? Number(cents) : NaN if (!Number.isFinite(n)) return null try { return new Intl.NumberFormat("en-GB", { style: "currency", currency: "USD" }).format(n / 100) } catch { return `US$${(n / 100).toFixed(2)}` } } // Only link to real http(s) URLs. function link(url, cta) { return typeof url === "string" && /^https?:\/\//.test(url) ? [{ cta, url }] : [] } // Look a key up without tripping over inherited names such as "toString". function pick(table, key, fallback) { return Object.prototype.hasOwnProperty.call(table, key) ? table[key] : fallback } // Each resource this recipe answers, and how loud it is. const EVENTS = { dispute: { title: "⚖️ New dispute", priority: 1 }, // High — the money is held and Gumroad may ask you for evidence dispute_won: { title: "✅ Dispute won", priority: -1 }, // Low — good news, the money is back } function handleRequest(request) { const form = readForm(request) const resource = text(field(form, "resource_name")) const event = pick(EVENTS, resource, null) // Guard: only dispute pings. They look like sale pings, so resource_name decides. if (!event) { console.log(`Ignoring Gumroad "${resource ?? "unknown"}" ping`) return null } const amount = usd(field(form, "price")) const who = text(field(form, "full_name")) ?? text(field(form, "email")) const product = text(field(form, "product_name")) ?? "a product" return { title: event.title, message: (resource === "dispute" ? `${who ?? "A customer"} disputed ${amount ?? "a payment"}` : `${amount ?? "A payment"} from ${who ?? "a customer"}`) + ` — ${product}`, topic: TOPIC, priority: event.priority, buttons: link("https://app.gumroad.com/customers", "View sales"), } } ``` ## Gumroad dispute webhook payload (sample) ```json { "card": { "type": "visa", "visual": "**** **** **** 4242" }, "email": "jane@example.com", "price": "4900", "sale_id": "yN3kP8sQ1wR5tU7vX9zA2g==", "currency": "usd", "disputed": "true", "quantity": "1", "referrer": "direct", "refunded": "false", "full_name": "Jane Doe", "permalink": "acme-course", "seller_id": "x7Q2kL0vT1aB7cD3eF5gHw==", "ip_country": "Netherlands", "product_id": "Qm9vc3RlclRlc3QxMjM0NQ==", "can_contact": "true", "dispute_won": "false", "gumroad_fee": "540", "order_number": "524980123", "product_name": "Acme Design Course", "purchaser_id": "1234567890123", "resource_name": "dispute", "sale_timestamp": "2026-09-29T09:45:53Z", "short_product_id": "qzxbt", "product_permalink": "https://acme.gumroad.com/l/acme-course", "discover_fee_charged": "false", "is_gift_receiver_purchase": "false" } ``` ## 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 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.