Generate Invoices
Overview
This guide explains how customer invoices are generated in Nue via API.
What Is Billing Schedule
A Billing Schedule in Nue defines when and how invoices are generated for customers. It supports both “On Demand” (one-time/single-run) and “Recurring” (e.g., daily, weekly, monthly, custom) execution patterns. Administrators can target specific customers, products, or orders by applying filters when setting up a schedule. Each billing schedule comprises a series of billing jobs—each billing job triggers invoice creation for all matching subscriptions/orders within its scope.
Core Concepts
- Billing Schedule: A saved set of parameters that governs how and when invoices are generated for associated orders/products. Can be run on demand or set to recur on custom intervals.
- Billing Job: A single execution instance of a billing schedule. Each run creates invoices (and optionally credit memos), processes results, and tracks job status.
Create Billing Schedule
You can create a billing schedule through the Nue API (Create Billing Schedule) to generate invoices for specific customers, products, or orders.
For example, the below request creates a recurring billing schedule for a specific customer (id: "001KS00000DVz1aYAD"), and the billing job will be executed every day at 3:00 AM.
curl -X POST "https://api.nue.io/billing/schedules" \
-H "nue-api-key: {yourApiKey}" \
-H "accept: application/json" \
-H "content-type: application/json" \
-d '{
"createdThrough": "API",
"scheduleStartDate": "2025-06-30",
"invoiceDate": "2025-06-30",
"targetDate": null,
"scheduleType": "Recurring",
"status": "Draft",
"recurringSchedule": "0 0 3 * * ? *",
"dailyObject": {},
"customExpression": [],
"recordType": "BillingSchedule",
"customerFilter": "{id:{_in:[\"001KS00000DVz1aYAD\"]}}",
"orderFilter": null,
"billCycleDayFilter": null,
"productFilter": null,
"description": "This is a sample billing schedule!"
}'The details of the created billing schedule will be returned:
{
"orderFilter": null,
"dailyObject": {},
"description": "This is a sample billing schedule!",
"lastRunDate": null,
"customExpression": [],
"billCycleDayFilter": null,
"recurringSchedule": "0 0 3 * * ? *",
"lastModifiedById": "424cb15f-da63-4d6a-b397-c15142058084",
"zoneId": "Asia/Shanghai",
"targetDateIncrementTimeUnit": "Days",
"id": "da17ce49-31b4-4f25-98b3-a7c1fc4a3d3a",
"createdById": "424cb15f-da63-4d6a-b397-c15142058084",
"targetDateIncrement": 0,
"targetDateIncrementSign": "Plus",
"productFilter": null,
"lastModifiedDate": "2025-06-30T02:42:32.016+00:00",
"targetDate": null,
"recordType": "BillingSchedule",
"createdThrough": "API",
"invoiceDate": "2025-06-30",
"customerFilter": "{id:{_in:[\"001KS00000DVz1aYAD\"]}}",
"createdDate": "2025-06-30T02:42:32.016+00:00",
"scheduleType": "Recurring",
"scheduleStartDate": "2025-06-30",
"name": "BS-00000200",
"status": "Draft"
}Activate Billing Schedule
Once the billing schedule is activated, billing jobs will start at the scheduled time, and invoices will be generated after executing the billing jobs. (Activate Billing Schedules)
curl -X POST "https://api.nue.io/billing/schedules:activate" \
-H "nue-api-key: {yourApiKey}" \
-H "accept: application/json" \
-H "content-type: application/json" \
-d '{
"scheduleIds": [
"da17ce49-31b4-4f25-98b3-a7c1fc4a3d3a"
]
}'If the setting 'Automatically generate the first invoice when an order is activated' is enabled, invoices will be generated when activating an order through Nue API