UNPKG

orb-billing

Version:

The official TypeScript library for the Orb API

41 lines 1.88 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../core/resource.mjs"; /** * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the request for payment for * a single subscription. This includes a set of line items, which correspond to prices in the subscription's plan and * can represent fixed recurring fees or usage-based fees. They are generated at the end of a billing period, or as * the result of an action, such as a cancellation. */ export class InvoiceLineItems extends APIResource { /** * This creates a one-off fixed fee invoice line item on an Invoice. This can only * be done for invoices that are in a `draft` status. * * The behavior depends on which parameters are provided: * * - If `item_id` is provided without `name`: The item is looked up by ID, and the * item's name is used for the line item. * - If `name` is provided without `item_id`: An item with the given name is * searched for in the account. If found, that item is used. If not found, a new * item is created with that name. The new item's name is used for the line item. * - If both `item_id` and `name` are provided: The item is looked up by ID for * association, but the provided `name` is used for the line item (not the item's * name). * * @example * ```ts * const invoiceLineItem = * await client.invoiceLineItems.create({ * amount: '12.00', * end_date: '2023-09-22', * invoice_id: '4khy3nwzktxv7', * quantity: 1, * start_date: '2023-09-22', * }); * ``` */ create(body, options) { return this._client.post('/invoice_line_items', { body, ...options }); } } //# sourceMappingURL=invoice-line-items.mjs.map