Class: Stripe::InvoiceLineItemService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/invoice_line_item_service.rb

Defined Under Namespace

Classes: ListParams, UpdateParams

Instance Method Summary collapse

Methods inherited from StripeService

#initialize, #request, #request_stream

Constructor Details

This class inherits a constructor from Stripe::StripeService

Instance Method Details

#list(invoice, params = {}, opts = {}) ⇒ Object

When retrieving an invoice, you’ll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.



228
229
230
231
232
233
234
235
236
# File 'lib/stripe/services/invoice_line_item_service.rb', line 228

def list(invoice, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/invoices/%<invoice>s/lines", { invoice: CGI.escape(invoice) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#update(invoice, line_item_id, params = {}, opts = {}) ⇒ Object

Updates an invoice’s line item. Some fields, such as tax_amounts, only live on the invoice line item, so they can only be updated through this endpoint. Other fields, such as amount, live on both the invoice item and the invoice line item, so updates on this endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only possible before the invoice is finalized.



242
243
244
245
246
247
248
249
250
# File 'lib/stripe/services/invoice_line_item_service.rb', line 242

def update(invoice, line_item_id, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/invoices/%<invoice>s/lines/%<line_item_id>s", { invoice: CGI.escape(invoice), line_item_id: CGI.escape(line_item_id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end