Payment Schedule contains the information needed to drive the creation of payments where they need to recur automatically. Payment schedules have a lookup relationship with Authorisation.
Their only function is to create Payment records, linked to Authorisations (Saved Payment methods) on a fixed schedule so that these payments can be collected automatically.
Most of our customers use their own objects (such as invoices or orders) to drive the automatic creation of payment records rather than using payment schedules.
The fields required when creating a Payment Schedule are:
Authorisation | Set to the authorisation record that should be used to collect the schedule payment. |
Frequency | The frequency at which the payment should be collected. |
Regular amount | The amount that should be taken from each payment. |
Next payment date | The date that you want the payment schedule to start collecting. This will be updated (according to the frequency) each time the schedule collects. |
Status | Either “In Force” or “Inactive”. This should be set to “In Force”, otherwise the schedule will not collect. If a “Final payment date” is set, then status will be automatically set to “Inactive” after the final payment has been taken. |
The Payment records will be created via the scheduled apex job "Asperato Repeat Payment".
To schedule this apex job if it hasn't been already:
- Navigate to Setup and search for Apex Classes in the Quick Find box at the left hand side of the screen
- On Apex Classes page click the ‘Schedule Apex’ button to create a new Apex job
- A screen will be displayed enabling you to establish the run criteria
- Enter a Job Name ‘Asperato Repeat Payment’ (recommended value)
- Next to the Apex Class box press the magnifying glass icon and in the list that displays select ‘BatchProcessPaymentSchedules’
- In the'Schedule Apex Execution' section set the Frequency to ‘Weekly’ and tick all the boxes under 'Recurs every week on'
- Select a Start date (defaults to today)
- Set an End date. The default is in one month and you should change this to a value a long time in the future such as 31/12/2050
- Set the Preferred Start Time to a value, a suggestion would be 04:00 or 05:00
- Save this record and that will schedule the task