--- title: "Schedule the direct debit batch" slug: "planifier-le-batch" updated: 2026-10-29T08:40:40Z published: 2026-10-29T08:40:40Z canonical: "help.frisbii.com/planifier-le-batch" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.frisbii.com/llms.txt > Use this file to discover all available pages before exploring further. # Schedule the direct debit batch Now Linda needs to schedule the batch that runs the direct debit of the invoices. ![](https://cdn.document360.io/b84e1b5d-2ba6-4465-8c62-fb45a2f31314/Images/Documentation/image(398).png?sv=2026-02-06&spr=https&st=2026-12-02T18%3A20%3A35Z&se=2026-12-02T19%3A20%3A35Z&sr=b&sp=r&sig=e9ZkTJ3GAGC2pQ5hKP5pIdS0xYOpzxIOK2SrFEMA2pc%3D) This article explains how to schedule a direct debit batch that debits invoices on the requested dates (in this article, for example, on the 5th of the month). The batch only debits invoices whose payment date is today or earlier. --- ## Schedule a direct debit batch To schedule the direct debit batch, Linda goes to **Setup > Apex Classes > Schedule Apex** and enters a job name (for example, *Direct debit batch*). She then clicks the magnifying glass next to **Apex Class** and selects **PspInvoiceScheduled**. Together, Linda and Mary define when the direct debit batch runs (for example, once a month on the 5th), the start date, the end date, and the time. ![](https://cdn.document360.io/b84e1b5d-2ba6-4465-8c62-fb45a2f31314/Images/Documentation/image-FIWZS3CO.png?sv=2026-02-06&spr=https&st=2026-12-02T18%3A20%3A35Z&se=2026-12-02T19%3A20%3A35Z&sr=b&sp=r&sig=f3ktD1S1J4gnThUIRw5akkrVSjnEmvlUXK2PiAOMWKw%3D) You can also run a script from the Developer Console to test the batch: 1. Open the Salesforce Developer Console. ![](https://cdn.document360.io/b84e1b5d-2ba6-4465-8c62-fb45a2f31314/Images/Documentation/image-0SPQXWEI.png?sv=2026-02-06&spr=https&st=2026-12-02T18%3A20%3A35Z&se=2026-12-02T19%3A20%3A35Z&sr=b&sp=r&sig=InveZVjer%2F%2FTpHir%2FEXhHjrdEJbrmRz2dA3bGYWf%2Bks%3D) 2. Click **Open Execute Anonymous Window**. ![](https://cdn.document360.io/b84e1b5d-2ba6-4465-8c62-fb45a2f31314/Images/Documentation/image-RIHQGQQ4.png?sv=2026-02-06&spr=https&st=2026-12-02T18%3A20%3A35Z&se=2026-12-02T19%3A20%3A35Z&sr=b&sp=r&sig=%2FRdECe25d6hBUMtG%2BdNwGx4T99RDoVKs45o27BU4Wbk%3D) 3. Copy and paste the script below and click **Execute**. Never use a value higher than 100 in the command. ```plaintext Sofactoapp.PspInvoiceScheduled batch = new sofactoapp.PspInvoiceScheduled(); Database.executeBatch(batch, 100); ``` --- ## Trigger conditions Well done! Once scheduled, the batch sends the payment records linked to an invoice to Stripe when the following conditions are met: - The payment method is **Stripe Recurring**. - There is a **PSP payment method with the status Active**. - The **payment date is today or earlier**. - The invoice is issued or in draft, depending on the configuration of your legal entity. - The **payment has the Pending checkbox selected** (considered an unpaid invoice). **Use case:** An invoice has a payment date of January 5, 2024. The PSP payment method was set to Active on January 10, 2024. The direct debit batch on February 5, 2024 debits both the January 5 and the February 5 invoices. --- ## Trigger a direct debit manually from a payment Outside the batch, you can exceptionally trigger the direct debit of a payment manually, for various reasons: the payment was rejected the first time and you want to try again, the payment should be debited instead of being paid by bank transfer, and so on. On the payment record, the **Collect this payment** button sends the payment to Stripe: ![](https://cdn.document360.io/b84e1b5d-2ba6-4465-8c62-fb45a2f31314/Images/Documentation/image-1AIE4Z0Q.png?sv=2026-02-06&spr=https&st=2026-12-02T18%3A20%3A35Z&se=2026-12-02T19%3A20%3A35Z&sr=b&sp=r&sig=cy5nHsBf7WU4MojW30MwqBBYMMHQoF9iT%2B4FT948Zt0%3D) As a Frisbii administrator, you can add filter conditions to the button so that it respects the trigger conditions described above. --- ## Bank reconciliation 1. The direct debit batch ran successfully, without errors. After the batch has run, an invoice has been recreated in Stripe, together with the account and the contact. Stripe, as the PSP, handles the transaction. - The **Pending** checkbox on the payment is cleared automatically (the payment is considered paid). - The payment status changes to **Cashed**. - The payment date is filled in with the date of the direct debit batch. - The invoice is settled. - The **Fees** field (`sofactoapp__Fee__c`) on the payment is filled in automatically: it brings the transaction fees charged by Stripe into Frisbii. Linda adds this field to the payment page layout so that Mary can see them. 2. The direct debit batch encountered an error. Linda reads the next article: [Stripe recurring: API error logs](/frisbii-app/docs/en/journaux-d-erreurs-api) **Frisbii tip** By default, after the customer has paid the invoice via Stripe, the payment record changes to **Status: Cashed** and the payment is no longer pending. If you activate the **UpdateRelatedPayment** flow, the status changes to **Collected** instead and the payment stays pending. This is because when a customer pays an invoice via Stripe, the amount is transferred to the company's bank account a few days later. The **Collected** status records a payment that has been made but is not yet visible in the bank account.