HomeGuidesRecipesAPI ExplorerForumSupport
Partner Portal
Partner Portal

Recurring invoices

Learn how to create and manage recurring invoices in Monite.

With Monite, you can set up monthly recurring invoices to bill an entity's customers the same amount every month. This is useful, for example, when implementing subscriptions or monthly service bills.

Recurring invoices can be issued on the first or last day of the month.

Create a recurring invoice

1. Create a draft invoice

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.

📘

Each invoice can have only one recurrence schedule associated with it.

2. Set up the recurrence

Next, you need to configure the recurrence schedule for the base invoice. Call POST /recurrences and specify the base invoice ID, start month and year, end month and year, and the day of month (first or last) on which the recurring invoices will be issued:

curl -X POST 'https://api.sandbox.monite.com/v1/recurrences' \
     -H 'X-Monite-Version: 2024-01-31' \
     -H 'X-Monite-Entity-Id: ENTITY_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -H 'Content-Type: application/json' \
     -d '{
       "invoice_id": "8beb7faa-6851-44c8-9fb9-24a94ca30343",
       "start_month": 8,
       "start_year": 2022,
       "end_month": 10,
       "end_year": 2022,
       "day_of_month": "first_day"
     }'

📘

Notes

  • Month numbers are 1-based: January is 1, December is 12.
  • end_month and end_year are required for the recurrence schedule. Currently, invoices cannot be infinitely recurring. However, you can extend a recurrence when it's reaching its end date.
  • The first recurring invoice will be issued on the next matching date that follows the start date or today's date (whichever one is later).
    For example, if today is September 8 and you create a recurrence with September as the start_month and day_of_month = "first_day", the first recurring invoice will be issued on October 1. No invoice will be issued in September because September 1 has already passed.

When a recurrence schedule is created, the status of the base invoice is changed from "draft" to "recurring". Monite also calculates the scheduled issue dates for all instances of the recurring invoice, and returns these dates in the iterations list in the response from POST /recurrences:

{
  "invoice_id": "8beb7faa-6851-44c8-9fb9-24a94ca30343",
  "start_month": 8,
  "start_year": 2022,
  "end_month": 10,
  "end_year": 2022,
  "day_of_month": "first_day",
  "id": "b17d34e3-63c0-4c44-a39c-e09a162ef3b4",
  "created_at": "2022-07-11T09:25:56.792883+00:00",
  "updated_at": "2022-07-11T09:25:56.792892+00:00",
  "iterations": [
    {
      "issue_at": "2022-08-01",
      "issued_invoice_id": null,
      "status": "pending",
      "iteration": 1
    },
    {
      "issue_at": "2022-09-01",
      "issued_invoice_id": null,
      "status": "pending",
      "iteration": 2
    },
    {
      "issue_at": "2022-10-01",
      "issued_invoice_id": null,
      "status": "pending",
      "iteration": 3
    }
  ],
  "status": "active",
  "current_iteration": 1
}

📘

The issued_invoice_id fields in the iterations list is null because the instances of the recurring invoice will be created later, on their scheduled issue dates. The issued_invoice_id will be automatically generated and populated on each issue date.

3. Track the issued invoices

When a recurring invoice is due to be issued, Monite creates a copy of the base invoice with the following additional values:

  • based_on - set to the ID of the base invoice.
  • document_id - an auto-generated invoice document number in the format INV-nnnnn.
  • issue_date - set to the current date.
  • status - set to "issued".

The invoice due date is calculated automatically based on the payment terms of the base invoice, and is returned in the due_date field on the invoice response object. For example, if the issue date is 2024-08-01 and the payment terms are Net 10, the due_date is set to 2024-08-11.

The ID of the new invoice is saved to the issued_invoice_id field in the Recurrence object, and the status of the corresponding recurrence iteration changes to either "completed" (if the invoice was issued successfully) or "issue_failed". The recurrence's current_iteration is incremented to reflect the next pending invoice.

The response from GET /recurrence/{recurrence_id} would now look like this:

{
  "invoice_id": "<ID of the base invoice>",
  "start_month": 8,
  "start_year": 2022,
  "end_month": 10,
  "end_year": 2022,
  "day_of_month": "first_day",
  "id": "b17d34e3-63c0-4c44-a39c-e09a162ef3b4",
  ...
  "iterations": [
    {
      "issue_at": "2022-08-01",
      "issued_invoice_id": "<ID of the issued recurring invoice>",
      "status": "completed",
      "iteration": 1
    },
    {
      "issue_at": "2022-09-01",
      "issued_invoice_id": null,
      "status": "pending",
      "iteration": 2
    },
    ...
  ],
  "status": "active",
  "current_iteration": 2
}

If the issued invoice is the last one according to the schedule, the recurrence status is changed to "completed" to indicate that no future invoices will be issued:

{
  ...
  "id": "b17d34e3-63c0-4c44-a39c-e09a162ef3b4",
  ...
  "iterations": [ ... ],
  "status": "completed",
  ...
}

Send the issued invoices

When a recurring invoice is issued, it is not automatically sent to the associated counterpart. You will need to send the invoice yourself.

You can track the scheduled issue dates and set up external reminders or an external automated task to send the recurring invoices once they have been issued.

Manage recurring invoices

View all recurring invoices

Use GET /recurrences to get a list of base invoice IDs and their recurrence schedule.

curl -X GET 'https://api.sandbox.monite.com/v1/recurrences' \
     -H 'X-Monite-Version: 2024-01-31' \
     -H 'X-Monite-Entity-Id: ENTITY_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' 

The invoice_id fields in the response specify the base invoice IDs, and the iterations[i].issued_invoice_id fields contain the IDs of the existing recurring invoices that have been generated from the base invoices:

{
  "data": [
    {
      "invoice_id": "<base invoice ID>",
      "start_month": 8,
      "start_year": 2022,
      "end_month": 10,
      "end_year": 2022,
      "day_of_month": "first_day",
      ...
      "iterations": [
        {
          "issue_at": "2022-08-01",
          "issued_invoice_id": "<ID of an already issued recurring invoice>",
          "status": "completed",
          "iteration": 1
        },
		    ...
      ],
      "status": "active",
      "current_iteration": 2
    },
	  ...
  ]
}

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 the invoice details

Once a recurring invoice has been configured, the invoice details (such as line items) cannot be changed. If you need to update the invoice details, you must cancel the current recurring invoice and create a new one.

Extend a recurring invoice

To extend a recurring invoice past its scheduled end date, send the new end_month and/or end_year in a PATCH /recurrences/{recurrence_id} request:

curl -X PATCH 'https://api.sandbox.monite.com/v1/recurrences/b17d34e3-63c0-4c44-a39c-e09a162ef3b4' \
     -H 'X-Monite-Version: 2024-01-31' \
     -H 'X-Monite-Entity-Id: ENTITY_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -H 'Content-Type: application/json' \
     -d '{
       "end_month": 12,
       "end_year": 2023
     }'

The response will reflect the additional scheduled iterations:

{
  ...
  "start_month": 8,
  "start_year": 2022,
  "end_month": 12,
  "end_year": 2023,
  ...
  "iterations": [
    ...
    {
      "issue_at": "2023-12-01",
      "issued_invoice_id": null,
      "status": "pending",
      "iteration": 17
    }
  ],
  "status": "active",
  "current_iteration": 1
}

Change the recurrence schedule

You can change the day of the month on which the recurring invoices will be issued. Currently, it can be either the first or last day of the month. Changing the day affects the issue date of future invoices only, it does not affect already issued invoices.

curl -X PATCH 'https://api.sandbox.monite.com/v1/recurrences/b17d34e3-63c0-4c44-a39c-e09a162ef3b4' \
     -H 'X-Monite-Version: 2024-01-31' \
     -H 'X-Monite-Entity-Id: ENTITY_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -H 'Content-Type: application/json' \
     -d '{
       "day_of_month": "last_day"
     }'

The response will reflect the new scheduled issue_at dates for the future iterations of the recurring invoice.

❗️

Changing day_of_month from "last_day" to "first_day" for an active recurring invoice usually results in no iteration in the current month. This can happen even if you make the change on the first day of a month.

Example: Consider a recurring invoice series that started in June and is issued on the last day of a month. On August 5, the day_of_month is changed from "last_day" to "first_day". As a result, no invoice will be issued in August - because the first day of August has already passed. The next invoice will be issued on September 1.

📘

Tip

You can change day_of_month together with end_month and end_year in the same PATCH request.

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 that, call POST /recurrences/{recurrence_id}/cancel:

curl -X POST 'https://api.sandbox.monite.com/v1/recurrences/b17d34e3-63c0-4c44-a39c-e09a162ef3b4/cancel' \
     -H 'X-Monite-Version: 2024-01-31' \
     -H 'X-Monite-Entity-Id: ENTITY_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' 

This prevents future invoices from being generated and issued, but existing issued invoices are not affected. The status of the recurrence schedule and its future iterations becomes "canceled".

📘

Canceled recurring invoices cannot be reactivated. The invoice and its recurrence schedule will have to be recreated anew.