Scheduled payments
Set up and run scheduled payments in your collection module.
Scheduled payments let your collection module plan a policy's future payments and collect them automatically.
Prerequisites
Before you create scheduled payments:
- Create a collection module.
- Add a payment method to the policy.
- Decide whether your provider is API-based or file-based. See Submit scheduled payments to compare the two paths and choose.
- Confirm which hooks your module implements: lifecycle hooks such as
afterPolicyIssuedandafterPaymentSucceededthat return scheduling actions, plus your submission hook if you use an API provider. See Create and manage schedules and Submit scheduled payments.
How it works
A scheduled payment moves through three stages:
- Schedule. A lifecycle hook in your module returns a
schedule_paymentaction. The platform records the schedule. Nothing is collected yet; this is a forecast of a future payment. - Create. On the due date, or within the
submissionLeadTimewindow, the platform turns the schedule into a real payment withpendingstatus. - Submit. The platform sends the pending payment to a provider. For API providers, your module submits it through a hook you write.
You never call an API to create a schedule and you never write to billing tables. You return actions and write hooks; the platform does the rest.
For file-based debit providers, you write no submission code. The platform batcher submits those payments for you. The submission steps in this guide apply only to API providers.
Scheduled payment guides
Add billingSettings, configure batching, set retry behaviour, and confirm date and amount formats.
Return schedule_payment, reschedule_payment, and unschedule_payment actions from lifecycle hooks.
Submit due payments through an API provider hook, return per-payment results, and prevent duplicate charges.
Review scheduled payment lifecycle events and diagnose common setup and submission issues.
See a complete monthly card module example with configuration, recurrence, and submission code.
Recommended path
- Configure scheduled payments in
root.config.json. - Create the first schedule and recurring schedules from lifecycle hooks.
- Submit scheduled payments if you use an API provider.
- Use events and troubleshooting to monitor the flow.
- Compare your implementation with the scheduled payments example.