BACS Collection Scheduler & Submission Job
BACS Collection Scheduler & Submission Job
Overview
The BACS Collection Scheduler is the automated engine that drives Direct Debit collections through the BACS payment cycle. Running as a daily background job on every BACS working day, it identifies mandates due for collection, creates collection records, and submits payment requests to Modulr — all without manual intervention.
How It Works
1. Daily Cron Trigger
The scheduler is implemented as an Inngest cron job that fires once per day, but only on valid BACS working days (i.e. Monday–Friday, excluding UK bank holidays). This ensures that no collection attempts are made on non-processing days.
2. Mandate Query
On each run, the job queries the database for all mandates that meet the following criteria:
- Status is active
- Collection date falls within the next 3 working days
The 3-working-day lookahead window is aligned with the BACS submission cycle, which requires collections to be submitted in advance of the intended settlement date.
3. Collection Record Creation
For each qualifying mandate, the scheduler creates a new collection record in the database. This record is initially set to a status of scheduled and acts as the authoritative audit trail for the collection attempt.
4. BACS Submission to Modulr
The scheduler submits a BACS collection request to Modulr for each mandate. Modulr handles the downstream BACS submission and interfaces with the tenant's bank to debit the agreed amount.
Webhook Handling
Modulr processes BACS collections asynchronously. The service listens for two webhook events from Modulr to track the outcome of each submission:
Settlement Confirmation
When Modulr confirms that funds have successfully settled from the tenant's account, the service:
- Transitions the collection record from
scheduled→collected - Makes funds available for the downstream sweep-to-holding flow
Failure / Return
When Modulr reports that a collection has failed or been returned (e.g. insufficient funds, cancelled mandate, bank rejection), the service:
- Transitions the collection record from
scheduled→failed - Triggers clawback logic to protect the holding account reserve
Collection Status Reference
| Status | Triggered By | Description |
|---|---|---|
scheduled | Cron job | Collection record created and BACS request submitted to Modulr |
collected | Modulr settlement webhook | Funds successfully debited from the tenant's account |
failed | Modulr failure/return webhook | Collection failed; clawback logic initiated |
Key Design Notes
- BACS working days only — the cron job is aware of UK bank holidays and will not run on non-processing days.
- 3-working-day window — mandates are picked up in advance of their collection date to comply with BACS submission lead times.
- Async by design — collection outcomes are not known immediately; they are resolved via Modulr webhooks, keeping the submission flow non-blocking.
- Idempotency — each mandate/collection date combination should only produce one collection record, preventing duplicate submissions on re-runs.
- Clawback integration — failed collections automatically feed into the clawback reserve logic to ensure the holding account remains adequately protected.
Related
- Changelog — v1.0.41
- Fund Flow Overview (if available)
- Clawback Reserve (if available)