Class: Orb::Resources::InvoiceLineItems

Inherits:
Object
  • Object
show all
Defined in:
lib/orb/resources/invoice_line_items.rb,
sig/orb/resources/invoice_line_items.rbs

Overview

An 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.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ InvoiceLineItems

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of InvoiceLineItems.

Parameters:



63
64
65
# File 'lib/orb/resources/invoice_line_items.rb', line 63

def initialize(client:)
  @client = client
end

Instance Method Details

#create(amount:, end_date:, invoice_id:, quantity:, start_date:, item_id: nil, name: nil, request_options: {}) ⇒ Orb::Models::InvoiceLineItemCreateResponse

Some parameter documentations has been truncated, see Models::InvoiceLineItemCreateParams for more details.

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).

Parameters:

  • amount (String)

    The total amount in the invoice's currency to add to the line item.

  • end_date (Date)

    A date string to specify the line item's end date in the customer's timezone.

  • invoice_id (String)

    The id of the Invoice to add this line item.

  • quantity (Float)

    The number of units on the line item

  • start_date (Date)

    A date string to specify the line item's start date in the customer's timezone.

  • item_id (String, nil)

    The id of the item to associate with this line item. If provided without name,

  • name (String, nil)

    The name to use for the line item. If item_id is not provided, Orb will search

  • request_options (Orb::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



49
50
51
52
53
54
55
56
57
58
# File 'lib/orb/resources/invoice_line_items.rb', line 49

def create(params)
  parsed, options = Orb::InvoiceLineItemCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "invoice_line_items",
    body: parsed,
    model: Orb::Models::InvoiceLineItemCreateResponse,
    options: options
  )
end