# Mollie invoice paid notifications on your phone

> Get a push notification when a customer pays one of your Mollie sales invoices.

- Company: Mollie (https://www.justpush.io/recipes/mollie)
- Event: `sales-invoice.paid` (sales-invoice.paid)
- Tags: Finance, Payments
- Install: https://studio.justpush.io/recipes/mollie/sales-invoice-paid
- Web page: https://www.justpush.io/recipes/mollie/sales-invoice-paid

## 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 the Mollie Dashboard, go to Developers > Webhooks and create a new webhook.
3. Paste your webhook URL (shown in Studio after install) as the URL and select the sales-invoice.paid event.
4. Choose the full payload (so the payment details are included) and save.
5. This recipe needs a **next-gen** webhook (Developers > Webhooks), set to send the **full payload**. Classic webhooks (the `webhookUrl` you pass when creating a payment) only send the payment ID, so they can't produce a useful notification.
6. Mollie signs next-gen webhooks with an `X-Mollie-Signature` header, but JustPush doesn't check it yet, 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
// Mollie → sales-invoice.paid
// Fires when one of your Mollie sales invoices is paid.
// Docs: https://docs.mollie.com/reference/webhooks-new
//
// Needs a next-gen Mollie webhook (Developers > Webhooks) for the "sales-invoice.paid" event,
// set to send the full payload, pointing at the integration's endpoint URL.

// Mollie amounts are objects with a decimal string: { value: "10.00", currency: "EUR" }.
// Returns null when there's no amount.
function money(amount) {
    const value = Number(amount?.value)

    if (amount?.value == null || !Number.isFinite(value) || !amount.currency) return null

    try {
        return new Intl.NumberFormat("en-GB", { style: "currency", currency: amount.currency }).format(value)
    } catch {
        return `${amount.value} ${amount.currency}`
    }
}

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

    // Guard: only handle this event type, so other Mollie events on this integration stay quiet.
    if (event?.resource !== "event" || event.type !== "sales-invoice.paid") {
        console.log(`Ignoring Mollie event "${event?.type ?? "unknown"}"`)
        return null
    }

    // Next-gen webhooks only include the object when "full payload" is chosen.
    const entity = event._embedded?.entity

    if (!entity) {
        console.log("No embedded entity — set the webhook to send the full payload")
        return null
    }

    const recipient = entity.recipient ?? {}
    const who =
        recipient.organizationName ??
        ([recipient.givenName, recipient.familyName].filter(Boolean).join(" ") || recipient.email)
    const total = money(entity.totalAmount ?? entity.amountDue)

    return {
        title: "🧾 Invoice paid",
        message:
            (entity.invoiceNumber ? `Invoice ${entity.invoiceNumber}` : "An invoice") +
            (total ? ` — ${total}` : "") +
            (who ? ` from ${who}` : ""),
        topic: "Mollie",
        priority: 0, // Normal — money in is good news, not an emergency
        sound: "cashregister",
    }
}
```

## Mollie sales-invoice.paid webhook payload (sample)

```json
{
  "id": "event_GvJ8WHrp5isUdRub9CJyH",
  "type": "sales-invoice.paid",
  "_links": {
    "documentation": {
      "href": "https://docs.mollie.com/reference/webhooks-new",
      "type": "text/html"
    }
  },
  "entityId": "invoice_4Y0eZitmBnQ6IDoMqZQKh",
  "resource": "event",
  "_embedded": {
    "entity": {
      "id": "invoice_4Y0eZitmBnQ6IDoMqZQKh",
      "paidAt": "2026-09-28T09:29:47+00:00",
      "status": "paid",
      "resource": "sales-invoice",
      "amountDue": {
        "value": "0.00",
        "currency": "EUR"
      },
      "recipient": {
        "type": "business",
        "email": "billing@acme.example",
        "organizationName": "Acme BV"
      },
      "totalAmount": {
        "value": "1210.00",
        "currency": "EUR"
      },
      "invoiceNumber": "2026-0042"
    }
  },
  "createdAt": "2026-09-28T09:29:48.0Z"
}
```

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