---
title: "Webhooks and scheduled tasks"
weight: 80
description: "Log of webhook notifications received from Mollie and configuration of the synchronization scheduled tasks."
source_hash: "19c11eab"
---

# Webhooks and scheduled tasks

## Webhooks

Access: **Bank > Mollie > Webhooks** (administrators only)

Webhooks are automatic notifications sent by Mollie to your Dolibarr server when an event occurs (payment received, refund processed, chargeback opened, etc.).

### Webhook configuration

The webhook URL is automatically managed by the module. It follows the format:

```
https://your-dolibarr.example.com/custom/mollie/public/hook.php
```

This URL is communicated to Mollie when each payment is created. Mollie then sends the notifications to this address.

> **Important**: The webhook URL must be reachable from the Internet (not `localhost`). In test mode, you can use a tool like ngrok to expose your local server.

### Handled event types

The module automatically processes notifications for:

| ID prefix | Event type | Action |
|------------|-----------------|--------|
| `tr_` | Payment | Status update, synchronization of refunds and chargebacks |
| `re_` | Refund | Synchronization of the refunds of the associated payment |
| `sub_` | Subscription | Subscription status update |
| `chb_` | Chargeback | Synchronization of the chargebacks of the associated payment |
| `stl_` | Settlement | Creation or update of the settlement |
| `pl_` | Payment link | Payment link status update |

### Webhook log

The **Webhooks** page displays the history of all notifications received:

- **Mollie ID** of the concerned object
- **Event type** (payment, refund, subscription, chargeback, settlement, payment_link)
- **Processing status**:
  - **Received** - Notification received, being processed
  - **Processed** - Notification processed successfully
  - **Failed** - Error during processing
  - **Ignored** - Notification ignored (unknown type)
- **HTTP code** returned (200 = success, 400 = invalid notification, 500 = temporary failure)
- **Processing time** in milliseconds
- **Reception date**

![Webhook log with event types, HTTP codes and processing times](screenshots/webhooks-journal.webp)

### Webhook card

The detail card displays:

- General information (ID, type, status, HTTP code)
- Processing time
- Reception and processing dates
- **Error message** (in red if processing failed)
- **Raw content** (JSON payload) of the notification, displayed formatted

> The webhook log is a diagnostic tool. It allows verifying that Mollie notifications are correctly received and processed. In case of a problem, check the error message in the webhook card.

### What happens on failure

Mollie resends a notification for **26 hours** as long as the response is not a success. The module relies on this behavior:

- **Temporary failure** (busy database, setting not yet filled in, invoice creation error): the module answers **500**. Mollie will redeliver the notification and the payment will end up recorded.
- **Definitive failure** (payment in a currency other than the object's, amount different from the announced one, object not found): the module answers **200** to avoid retrying in a loop, and the notification remains with the **Failed** status for manual review.

In both cases, the log line keeps the error message.

> If the user for actions is not filled in the configuration, all payment notifications fail with a 500 code. Fill it in: the notifications will be redelivered by Mollie, and the scheduled task replays the webhooks that remained failed on its side.

## Scheduled tasks

The module defines three scheduled tasks (cron jobs) for automatic synchronization. They are **disabled by default** and must be enabled manually from **Home > Setup > Scheduled tasks**.

### MollieCheckPay

**Payment and payout check**

- **Frequency**: Daily
- **Action**: Checks the statuses of ongoing payments with the Mollie API and synchronizes payouts
- **Usefulness**: Safety net to catch missed webhooks

### MollieCheckTakePayments

**Automatic payment launch**

- **Frequency**: Daily
- **Action**: Looks for unpaid invoices whose payment method is card or SEPA direct debit (associated with the Mollie bank account) and automatically starts the direct debits
- **Usefulness**: Full automation of collections

An invoice is only selected if the customer has a **valid mandate** recorded in the module (a `directdebit` mandate for a SEPA direct debit, `creditcard` for a card), as it appears in **Bank > Mollie > SEPA mandates**.

> Mandates signed from the public page are therefore taken into account. If a customer is never debited, first check that they appear in the mandates list with the *Valid* status and the right method.

This task only works in **production mode**: in test mode, it stops immediately with a message in the logs.

### MollieCheckInvoicesPaid

**Paid invoice update**

- **Frequency**: Daily
- **Action**: Checks the Dolibarr invoices attached to the Mollie bank account and marks them as "Paid" when nothing remains to be paid, credit notes and down payments included
- **Usefulness**: Status synchronization between Mollie and Dolibarr

> This task only touches invoices whose bank account is the Mollie account: closing an invoice collected through another channel is not its job.

### Scheduling

The tasks are scheduled at a random time between midnight and 6 a.m. to avoid overloading the Mollie API if several Dolibarr installations run the tasks simultaneously.

> **Tip**: It is recommended to enable at least the **MollieCheckPay** task as a safety net, even if the webhooks work correctly.
