Class: Stripe::InvoiceCreatePreviewParams::InvoiceItem

Inherits:
RequestParams
  • Object
show all
Defined in:
lib/stripe/params/invoice_create_preview_params.rb

Defined Under Namespace

Classes: Discount, Period, PriceData

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

attr_accessor, coerce_params, coerce_value, new, #to_h

Constructor Details

#initialize(amount: nil, currency: nil, description: nil, discountable: nil, discounts: nil, invoiceitem: nil, metadata: nil, period: nil, price: nil, price_data: nil, quantity: nil, quantity_decimal: nil, tax_behavior: nil, tax_code: nil, tax_rates: nil, unit_amount: nil, unit_amount_decimal: nil) ⇒ InvoiceItem

Returns a new instance of InvoiceItem.



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 310

def initialize(
  amount: nil,
  currency: nil,
  description: nil,
  discountable: nil,
  discounts: nil,
  invoiceitem: nil,
  metadata: nil,
  period: nil,
  price: nil,
  price_data: nil,
  quantity: nil,
  quantity_decimal: nil,
  tax_behavior: nil,
  tax_code: nil,
  tax_rates: nil,
  unit_amount: nil,
  unit_amount_decimal: nil
)
  @amount = amount
  @currency = currency
  @description = description
  @discountable = discountable
  @discounts = discounts
  @invoiceitem = invoiceitem
  @metadata = 
  @period = period
  @price = price
  @price_data = price_data
  @quantity = quantity
  @quantity_decimal = quantity_decimal
  @tax_behavior = tax_behavior
  @tax_code = tax_code
  @tax_rates = tax_rates
  @unit_amount = unit_amount
  @unit_amount_decimal = unit_amount_decimal
end

Instance Attribute Details

#amountObject

The integer amount in cents (or local equivalent) of previewed invoice item.



276
277
278
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 276

def amount
  @amount
end

#currencyObject

Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies). Only applicable to new invoice items.



278
279
280
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 278

def currency
  @currency
end

#descriptionObject

An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking.



280
281
282
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 280

def description
  @description
end

#discountableObject

Explicitly controls whether discounts apply to this invoice item. Defaults to true, except for negative invoice items.



282
283
284
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 282

def discountable
  @discountable
end

#discountsObject

The coupons to redeem into discounts for the invoice item in the preview.



284
285
286
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 284

def discounts
  @discounts
end

#invoiceitemObject

The ID of the invoice item to update in preview. If not specified, a new invoice item will be added to the preview of the upcoming invoice.



286
287
288
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 286

def invoiceitem
  @invoiceitem
end

#metadataObject

Set of [key-value pairs](docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to ‘metadata`.



288
289
290
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 288

def 
  @metadata
end

#periodObject

The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](docs.stripe.com/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](docs.stripe.com/revenue-recognition/methodology/subscriptions-and-invoicing) for details.



290
291
292
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 290

def period
  @period
end

#priceObject

The ID of the price object. One of ‘price` or `price_data` is required.



292
293
294
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 292

def price
  @price
end

#price_dataObject

Data used to generate a new [Price](docs.stripe.com/api/prices) object inline. One of ‘price` or `price_data` is required.



294
295
296
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 294

def price_data
  @price_data
end

#quantityObject

Non-negative integer. The quantity of units for the invoice item. Use ‘quantity_decimal` instead to provide decimal precision. This field will be deprecated in favor of `quantity_decimal` in a future version.



296
297
298
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 296

def quantity
  @quantity
end

#quantity_decimalObject

Non-negative decimal with at most 12 decimal places. The quantity of units for the invoice item.



298
299
300
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 298

def quantity_decimal
  @quantity_decimal
end

#tax_behaviorObject

Only required if a [default tax behavior](docs.stripe.com/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of ‘inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.



300
301
302
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 300

def tax_behavior
  @tax_behavior
end

#tax_codeObject



302
303
304
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 302

def tax_code
  @tax_code
end

#tax_ratesObject

The tax rates that apply to the item. When set, any ‘default_tax_rates` do not apply to this item.



304
305
306
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 304

def tax_rates
  @tax_rates
end

#unit_amountObject

The integer unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount. If you want to apply a credit to the customer’s account, pass a negative unit_amount.



306
307
308
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 306

def unit_amount
  @unit_amount
end

#unit_amount_decimalObject

Same as ‘unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.



308
309
310
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 308

def unit_amount_decimal
  @unit_amount_decimal
end

Class Method Details

.field_encodingsObject



348
349
350
351
352
353
354
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 348

def self.field_encodings
  @field_encodings = {
    price_data: { kind: :object, fields: { unit_amount_decimal: :decimal_string } },
    quantity_decimal: :decimal_string,
    unit_amount_decimal: :decimal_string,
  }
end