Linda would like to set up batch generation of the SEPA file, to make Mary's work easier and save her having to generate her files manually.
Batch planning
Here is the procedure for scheduling the automatic batch generation of the SEPA file:
From Salesforce configuration
Search for "Apex Classes"
Click on "Schedule Apex"

Give the task a name and add the "SepaDirectDebitBatch" class.
Then enter the desired day and time.

Note:
If required, you can also run the batch manually from the developer console using this script:
Open the developer console

Click on "Debug" and "Open Execute Anonymous Window" :

Then copy and paste this script :
Date invoiceDate = Date.newInstance(AAAA, MM, JJ); //(insert date of invoices concerned)
Database.executeBatch(new SepaDirectDebitBatch(invoiceDate), 200);
by entering the current date here : (YYYY, MM, DD)
Invoice creation
Linda is now creating 2 "ex nihilo" invoices for her tests:
Invoice #1:
An invoice ex nihilo dated 20/02/2026
One payment method: Direct debit
With an active PSP payment method
30-day net payment term
or a Payment with a date of 22/03/2026, corresponding to the date of debit of this invoice
Linda issues this first invoice.

Invoice #2:
An invoice ex nihilo dated 20/02/2026
One payment method: Direct debit
With an active PSP payment method
But this time, a payment term of 60 days net
or a Payment with a date of 04/21/2026, corresponding to the debit date of this invoice
Linda issues this second invoice.

Then Linda launched the batch via the developer console.
Result The file is stored in Salesforce Files.

From the application launcher, search for "Files".
IMPORTANT : it is important to note that one file is generated per collection date.
As a result, from Files, Linda sees 2 SEPA direct debit files, i.e. 1 file per collection date.

The file is named as follows: SEPA_<date_de_generation>_<date_de_collecte>.xml
Example: SEPA_20260226_2026-04-21 corresponds to the SEPA file generated on 26/02/2026 for invoice #2 with a payment date of 21/04/2026.
Sending the SEPA direct debit file by e-mail
Alternatively, Mary can also receive the file by e-mail, instead of downloading it from Files. The e-mail will contain the SEPA file as an attachment.
To do this, Linda configures the e-mail from Salesforce :
From Salesforce Configuration
Search for "Custom settings"
Click on Manage "SEPA Settings"

Click on "New" to activate mail sending from the org:

.png?sv=2026-02-06&spr=https&st=2026-06-08T06%3A22%3A24Z&se=2026-06-08T06%3A34%3A24Z&sr=c&sp=r&sig=lPIBCzCBSKFWD2QQvl67qCjWy4D7PEnpwnMbVhcFAmg%3D)
Then save.Then enter the e-mail addresses that will receive the SEPA file,
To do this, from "Custom metadata types" :
Click on "SEPA Email Recipient".
Start by entering the default email address: click on Modify in "Default":

Enter the e-mail address of the main recipient
Repeat the operation by clicking on "New", if several users are to receive the SEPA file by e-mail.
Then go back to "Custom settings" and click on "SEPA Settings".
Check the box for "Enable email sending":


Configuration is now complete.
To repeat the test scenario above, Mary will receive 1 e-mail containing all the SEPA files generated as attachments, i.e. 2 attachments with the 2 SEPA files corresponding to the 2 collection dates.
Checking the SEPA file
Linda wants to check the file format before submitting it to her bank.
There are free websites that allow you to check the content of the XML file, such as this one: https://www.sepaxml.com/tester-un-fichier-sepa-xml
Simply download the XML file from this site and get a result.