Recurring invoices
Overview
With Monite, entities can set up recurring invoices to bill their customers the same amount every month (or other period). This is useful, for example, when implementing subscriptions or regular service bills.
Monite provides flexible date- and interval-based scheduling options for recurring invoices. Invoices can be created as drafts or configured to be automatically issued and sent to the predefined recipients.
Create a recurring invoice
1. Create a draft invoice template
Start by creating the base invoice that will be used as the template for recurring invoices. You will need the invoice id for use in subsequent API calls. Keep this invoice in the draft status.
Verify the invoice data to make sure the invoice can be issued successfully.
Each invoice can have only one recurrence schedule associated with it.
2. Set up the recurrence
Next, configure the recurrence schedule for the base invoice. To do this, call POST /recurrences and specify the start date, frequency, end date or maximum number of invoices, and other settings. For a list of available settings, see Recurring invoice configuration.
After a recurrence schedule is created, the status of the base invoice is changed from draft to recurring.
Monite also calculates the scheduled creation dates for all instances of the recurring invoice, and returns these dates in the iterations list in the response from POST /recurrences:
The iterations array contains a list of all scheduled invoice iterations, both pending and past.
issue_atis the scheduled date when an invoice will be created or was created.issued_invoice_idis the ID of the created invoice. Initially the value isnullbecause those invoices are not created yet. The value will be populated as soon as each invoice is created.statusis one of:pending- invoice is scheduled to be created.canceled- when a recurrence in canceled, the remaining future iteractions get this status.completed- invoice has been successfully created according toautomation_level.issue_failed- when usingautomation_level=issueorissue_and_send, this status indicates that a draft invoice could not be issued. See How recurring invoices are generated for details.skipped- indicates iterations that were skipped while the recurrence is paused.send_failed- when usingautomation_level=issue_and_send, this status indicates that an invoice could not be automatically sent. See How recurring invoices are generated for details.
Recurring invoice configuration
The following fields are used in the request body for POST /recurrences and PATCH /recurrences/{recurrence_id}.
Schedule
Monite offers flexible date- and interval-based scheduling options for recurring invoices. Schedule parameters include:
start_date- Required. The date when the first invoice is to be created. Can be the current or future date. This date also defines the day of month/week/year when invoices will be created.- Either
end_dateormax_occurrences(total number of invoices to create) is required to define the end condition for the recurrence.Currently, invoices cannot be indefinitely recurring. However, you can extend a recurrence when it is reaching its end date. frequency- Can be monthly (default), weekly, daily, quarterly, or yearly.- When creating monthly or quarterly invoices on the 31st, 30th, or 29th, if a month does not have this day the invoice will be created on the last day of that month.
- When using weekly frequency, if you want to send invoices on a specific day of week (e.g. Tuesday) the
start_datemust fall on that day.
interval- How often invoices will be created based on the frequency, for example:- 1 (default) means every month/week/day/etc.
- 2 means every 2 months/weeks/days/etc.
Examples
Monthly invoice created on the 20th
Bi-weekly invoice created on Tuesday
To send weekly or bi-weekly invoices on a specific day of week, start_date must fall on that day of week.
Five quarterly invoices
Invoices will be created on January 31, April 30, July 31, and so on.
Time of day
Currently, Monite’s scheduler generates recurring invoices twice a day: at 0:00 UTC and 12:00 UTC.
Recurrences created between 0:00 UTC and 11:59 UTC will create invoices at 12:00 UTC on the scheduled day.
Recurrences created between 12:00 UTC and 23:59 UTC will create invoices at 0:00 UTC on the scheduled day.
Invoice creation modes
Monite lets you customize how recurring invoices are created and, optionally, sent out.
This is controlled by the automation_level value in the recurrence configuration, and can be configured for each recurring invoice separately.
You can change the automation_level setting at any time, even for existing recurrences.
Create invoices as drafts
automation_level = draft
Individual invoices are created in the draft status and are not issued or sent to the counterpart.
Use this mode if the users may need to review or modify recurring invoices before sending them (for example, add an extra line item or an external payment link).
Users will need to mark invoices as issued and send them manually.
Create invoices without sending
automation_level = issue
Individual invoices will have the issued status (that is, finalized and read-only) but will not be automatically sent to the counterpart.
This is useful if:
- invoices may need to be sent to a different email address,
- users want to manually trigger the sending of invoices (whether by using
POST /receivables/{invoice_id}/sendor through other means), - invoices are not emailed but instead get printed and sent via post.
Create and automatically send invoices
automation_level = issue_and_send
Individual invoices will have the issued status and will be automatically sent to the counterpart.
To use this mode, you must provide the following values in the recurrence configuration:
-
subject_text- email subject text. -
body_text- the text inserted in the email body. If you use custom email templates, this text substitutes the{{body_template}}variable in thereceivables_invoiceemail template. -
(Optional.)
recipients- the list of invoice recipients (To, CC, BCC). Can be omitted if the base invoice has the counterpart contact email specified in thecounterpart_contact.emailfield.- If both the recurrence’s
recipientsand the invoice’scounterpart_contact.emailare defined, recurring invoices will be sent to all of these email addresses.
- If both the recurrence’s
How recurring invoices are generated
When the date and time of a recurring invoice arrives, Monite creates a copy of the base invoice with the following additional values:
based_onis set to the ID of the base invoice.statusstarts as “draft”.- If
automation_levelisissueorissue_and_send:statusis immediatey changed from “draft” to “issued”.document_idis assigned an auto-generated invoice document number based on the entity’s document customization settings.issue_dateis set to the current date.- Invoice due date is calculated automatically based on the payment terms of the base invoice, and is returned in the
due_datefield on the invoice response object. For example, if the issue date is 2024-08-01 and the payment terms are Net 10, thedue_dateis set to 2024-08-11.
- If
automation_levelisissue_and_send, Monite then automatically sends the invoice to the specified recipients.
The ID of the created invoice is saved to the iterations[].issued_invoice_id field in the Recurrence object.
The status of the corresponding recurrence iteration is set to one of the following:
-
"completed"- the invoice was successfully created and sent to the recipients (if auto-sending is configured). -
"send_failed"- the invoice was issued but could not be sent to the recipients. You can callGET /receivables/{invoice_id}/mailsto check for email sending errors and then resend this invoice. -
"issue_failed"- the invoice could not be moved from thedrafttoissuedstatus. Thereceivable.failedwebhook is also triggered in this case.Normally this should not happen. You can verify the invoice data to see if there are any errors, then update invalid or missing data and re-issue the invoice. If the base invoice’s data is no longer valid or sufficient, update the base invoice to resolve the issue for future invoices.
interations[].status) in the recurrence configuration.The current_iteration in the recurrence configuration is then incremented to reflect the next pending invoice.
The response from GET /recurrence/{recurrence_id} will then look like this:
If the created invoice is the last one according to the schedule, the recurrence status is changed from "active" to "completed" to indicate that no future invoices will be created:
Manage recurring invoices
View all recurring invoices
Use GET /recurrences to get a list of base invoice IDs and their recurrence schedules.
The invoice_id fields in the response specify the base invoice IDs, and the iterations[i] fields contain the IDs of the existing recurring invoices that have been generated from the base invoices:
You can then use GET /receivable/{receivable_id} to fetch the details for a specific invoice ID, such as the total amount, line items, and so on.
Update invoice details
There are two ways to update invoice data for a recurring invoice:
- Update the base invoice template (the invoice in the
recurringstatus). The changes will be reflected in future invoices, but already created invoices are not affected. - With
automation_level=draft, individual invoices are created as drafts and users can edit them before sending out.
In any case, you can update any data in an invoice - line items, prices, payment terms, and so on.
To update the invoice number format, use the entity’s document number customizaton options.
To update the base invoice:
-
Call
GET /recurrences/{recurrence_id}to get the ID of the base invoice for that recurrence:Alternatively, call
GET /receivables?status=recurring(optionally with other filters) and find the ID of the needed invoice template among the results. -
Edit the base invoice by calling
PATCH /receivablesand providing the new values./{receivable_id}
Change the invoice schedule
You can change the frequency, interval, end condition, and other parameters of existing recurrences at any time.
If the recurrence has not begun yet, you can also change the start_date to another non-past date.
Changing the invoice schedule affects the creation date of future invoices only, it does not affect already created invoices.
To update the recurrence configuration, send the new values in a PATCH /recurrences request:
The response reflects the updated pending iterations and their scheduled dates. If the recurrence has been extended, additional iterations are added. If the end date has been moved ealier, excess pending iterations are removed.
Pause a recurring invoice
To temporarily pause a recurring invoice sequence, call POST /recurrences.
New invoices are not created while the recurrence is paused.
However, the corresponding scheduled invoice dates remain in the iterations array returned by GET /recurrences.
When the next scheduled invoice date is reached while the recurrence is paused, that iteration gets the "skipped" status to indicate that no invoice was created.
Skipped iterations still count towards the invoice limit for recurrences configured with max_occurrences.
To extend a paused recurrence, edit it and increase the max_occurrences value accordingly.
The recurrence stays in the "paused" status until either it is resumed or its end date or invoice limit is reached.
In the latter case, the recurrence status will be automatically changed from "paused" to "completed" once the end condition is met.
Resume a recurring invoice
To resume a paused recurrence, call POST /recurrences.
This changes the recurrence’s status back to "active", and the remaining invoices will be created based on the configured schedule.
Skipped invoices will not be created retroactively.
Cancel a recurring invoice
You may want to cancel a recurring invoice, for example, if an entity’s customer cancels their order or subscription. To do this, call POST /recurrences/{recurrence_id}/cancel.
This prevents future invoices from being created, but already created invoices are not affected.
The status of the recurrence and any pending invoices in the iterations array becomes "canceled".
Only active and paused recurrences can be canceled.
Canceled recurring invoices cannot be reactivated or otherwise updated. The invoice and its recurrence schedule will have to be recreated anew.