# Kit new purchase notifications on your phone > Get a push notification with the total, buyer and products whenever a purchase is recorded in Kit. - Company: Kit (https://www.justpush.io/recipes/kit) - Event: `purchase.purchase_create` (Purchase created) - Tags: Email marketing, Orders, Payments - Install: https://studio.justpush.io/recipes/kit/purchase - Web page: https://www.justpush.io/recipes/kit/purchase ## 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 Kit, open app.kit.com/webhooks and create a webhook endpoint. 3. Paste your webhook URL (shown in Studio after install) as the URL. 4. Subscribe it to Purchase created only and save. 5. Kit's webhooks page doesn't offer purchases yet (`subscriber.product_purchased` is still marked "planned"), so create a **legacy webhook** with one API call instead. Use your V4 API key from **Settings → Developer**: 6. ```bash 7. curl -X POST https://api.kit.com/v4/webhooks \ 8. -H "X-Kit-Api-Key: " \ 9. -H "Content-Type: application/json" \ 10. -d '{ "target_url": "your webhook URL (shown in Studio after install)", "event": { "name": "purchase.purchase_create" } }' 11. ``` 12. To stop it later, list your webhooks with `GET https://api.kit.com/v4/webhooks` and delete this one with `DELETE https://api.kit.com/v4/webhooks/`. 13. Legacy webhooks aren't signed or retried, so keep your endpoint URL private. They need a Kit plan with API access. ## 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 // Kit → purchase.purchase_create (new purchase) // Fires when a purchase is recorded in Kit, for example by a connected store. // Docs: https://developers.kit.com/api-reference/v3/webhooks // // This event only exists as a legacy webhook (created through the API, see INSTALL.md). // Kit documents the purchase fields at the top level; the recipe also accepts them // wrapped in { purchase: { … } }, as the purchases API returns them. // Kit sends purchase amounts as decimals (21.0 means 21.00). function money(amount, currency) { const value = typeof amount === "string" && amount.trim() ? Number(amount) : amount // Don't invent a figure when the purchase doesn't carry one. if (typeof value !== "number" || !Number.isFinite(value) || typeof currency !== "string" || !currency) return null try { return new Intl.NumberFormat("en-GB", { style: "currency", currency: currency.toUpperCase() }).format(value) } catch { return `${value} ${currency.toUpperCase()}` } } // Kit sends plain strings; treat blanks as missing. function text(value) { return typeof value === "string" && value.trim() ? value.trim() : null } function handleRequest(request) { const body = request.body && typeof request.body === "object" ? request.body : {} const purchase = body.purchase && typeof body.purchase === "object" ? body.purchase : body // Guard: a purchase has a transaction ID and a product list; subscriber events don't. if (!purchase.transaction_id || !Array.isArray(purchase.products) || body.events || body.subscriber) { console.log("Not a Kit purchase — skipping") return null } const total = money(purchase.total, purchase.currency) if (!total) { console.log("Kit purchase without a total or currency — skipping") return null } // Name the first product and count the rest. const products = purchase.products.filter((p) => p && typeof p === "object") const first = products[0] const qty = Number(first?.quantity) const item = text(first?.name) ? text(first.name) + (Number.isFinite(qty) && qty > 1 ? ` ×${qty}` : "") : null const what = item && products.length > 1 ? `${item} and ${products.length - 1} more` : item ?? "something" const who = text(purchase.email_address) ?? "Someone" return { title: `💰 New purchase: ${total}`, message: `${who} bought ${what}`, topic: "Kit", priority: 0, // Normal — money in, worth a smile sound: "cashregister", } } ``` ## Kit purchase.purchase_create webhook payload (sample) ```json { "id": 8, "tax": 2, "total": 21, "status": "paid", "currency": "EUR", "discount": 3, "products": [ { "sku": "7890-ijkl", "name": "Sticker pack", "quantity": 2, "unit_price": 5 }, { "sku": "mnop-1234", "name": "Zine, issue 4", "quantity": 1, "unit_price": 10 } ], "shipping": 2, "subtotal": 20, "email_address": "ada@example.com", "transaction_id": "123-abcd-456-efgh", "transaction_time": "2026-09-29T11:28:04Z" } ``` ## 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 Kit 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.