Use case 2: invoice and target dates recur in next month of bill run date
Suppose you want to schedule a bill run to execute on the 16th of each month, the invoice date recurs on the 1st day of each following month, and the target date on the end day of each following month, as follows.
Execution # |
Bill Run Date |
Invoice Date |
Target Date |
---|---|---|---|
1 |
2024-05-16 |
2024-06-01 |
2024-06-30 |
2 |
2024-06-16 |
2024-07-01 |
2024-07-31 |
3 |
2024-07-16 |
2024-08-01 |
2024-08-31 |
... |
Configure use case 2 through UI
To achieve the scheduled results of use case 2, when creating a scheduled bill run on the Create Scheduled Bill Run page, configure the following fields:
- Specify the Bill Run Date as 05/16/2024 and Repeats as Monthly
- Specify the Invoice Date as 06/01/2024 and select Day 1 of the next month of the run date on
- Specify the Target Date as 06/30/2024 and select Month end of the next month after the run date
- Preview the recurrence and scheduled dates at the right
Ensure you specify the Bill Run Date, Invoice Date, and Target Date as today or a future date.
The logic is as below:
- Bill run date scheduled results: By specifying the Bill Run Date as 05/16/2024 and the Repeats field as Monthly, the bill run is scheduled to be executed on the 16th of each month.
- Invoice date scheduled results: By specifying the Invoice Date as 06/01/2024, Zuora calculates the difference in months from your specified Bill Run Date05/16/2024 to the Invoice Date 06/01/2024 is one month (next month), and the day value of the Invoice Date is 01. Zuora displays the following options:
- 16 days after the bill run date
- Day 1 of the next month of the run date on
After you select the Day 1 of the next month of the run date on option, the invoice date recurs on the 1st day of the next month from the monthly scheduled bill run date.
- Target date scheduled results: By specifying the Target Date as 06/30/2024, Zuora calculates the difference in months from your specified Bill Run Date 05/16/2024 to the Target Date 06/30/2024 is one month (next month) and identifies that the 30th is the end day of the month, and thus displays the following options:
- 45 days after the bill run date
- Day 30 of the next month of the run date on
- Month end of the next month after the run date
After you select the Month end of the next month after the run date option, the target date recurs on the end day of the next month from the monthly scheduled bill run date.
If you use the 29th of February as the invoice or target date, you also need to select to schedule the date to reoccur on the 29th or at the end of the month.
Configure use case 2 through API
To achieve the scheduled results of use case 2, configure the following fields through the Create a bill run operation.
- Bill run date settings:
repeatFrom
:2024-05-16
repeatType
:Monthly
- Invoice date settings:
invoiceDateMonthOffset
:1
invoiceDateDayofMonth
:1
- Target date settings:
targetDateMonthOffset
:1
targetDateDayofMonth
:31
The logic is as below:
- Since you want to schedule the invoice date and target date in the next month from the monthly scheduled bill run date, that is, the scheduled invoice and target dates have the same month offset 1 from monthly scheduled bill run dates, set the
invoiceDateMonthOffset
andtargetDateMonthOffset
to1
. - Since you want to schedule the invoice date to recur on the 1st of each month, set the
invoiceDateDayofMonth
to1
. - Since you want to schedule the target date to recur on the end day of each month, set the
invoiceDateDayofMonth
to31
.
Since April only has 30 days, when you set the targetDateDayofMonth
to 31
, Zuora identifies that you want to schedule the target date to recur on the end day of the month rather than the 30th of the month. You can follow the same setting for February, which has only 28 or 29 days.
Request API example
Request | POST /v1/bill-runs |
---|---|
Request Body |
{ "autoEmail": false, "autoPost": false, "autoRenewal": false, "billRunFilters": [ { "accountId": "2c9081a03c63c94c013c66688a2c00bf", "filterType": "Account" } ], "chargeTypeToExclude": [ "OneTime", "Usage" ], "invoiceDate":null, "invoiceDateMonthOffset": 1, "invoiceDateDayOfMonth": 1, "name": "test", "noEmailForZeroAmountInvoice": false, "targetDate": null, "targetDateMonthOffset": 1, "targetDateDayOfMonth": 31, "schedule": { "repeatFrom": "2024-05-16", "repeatType": "Monthly", "runTime": 0 } } |