Class: Stripe::SubscriptionUpdateParams::Item

Inherits:
RequestParams show all
Defined in:
lib/stripe/params/subscription_update_params.rb

Defined Under Namespace

Classes: BillingThresholds, CurrentTrial, Discount, 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(billing_thresholds: nil, clear_usage: nil, current_trial: nil, deleted: nil, discounts: nil, id: nil, metadata: nil, plan: nil, price: nil, price_data: nil, quantity: nil, tax_rates: nil) ⇒ Item

Returns a new instance of Item.



486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/stripe/params/subscription_update_params.rb', line 486

def initialize(
  billing_thresholds: nil,
  clear_usage: nil,
  current_trial: nil,
  deleted: nil,
  discounts: nil,
  id: nil,
  metadata: nil,
  plan: nil,
  price: nil,
  price_data: nil,
  quantity: nil,
  tax_rates: nil
)
  @billing_thresholds = billing_thresholds
  @clear_usage = clear_usage
  @current_trial = current_trial
  @deleted = deleted
  @discounts = discounts
  @id = id
  @metadata = 
  @plan = plan
  @price = price
  @price_data = price_data
  @quantity = quantity
  @tax_rates = tax_rates
end

Instance Attribute Details

#billing_thresholdsObject

Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.



462
463
464
# File 'lib/stripe/params/subscription_update_params.rb', line 462

def billing_thresholds
  @billing_thresholds
end

#clear_usageObject

Delete all usage for a given subscription item. You must pass this when deleting a usage records subscription item. ‘clear_usage` has no effect if the plan has a billing meter attached.



464
465
466
# File 'lib/stripe/params/subscription_update_params.rb', line 464

def clear_usage
  @clear_usage
end

#current_trialObject

The trial offer to apply to this subscription item.



466
467
468
# File 'lib/stripe/params/subscription_update_params.rb', line 466

def current_trial
  @current_trial
end

#deletedObject

A flag that, if set to ‘true`, will delete the specified item.



468
469
470
# File 'lib/stripe/params/subscription_update_params.rb', line 468

def deleted
  @deleted
end

#discountsObject

The coupons to redeem into discounts for the subscription item.



470
471
472
# File 'lib/stripe/params/subscription_update_params.rb', line 470

def discounts
  @discounts
end

#idObject

Subscription item to update. If you omit ‘id`, the API adds a new subscription item rather than updating the existing one. See [Changing a subscription’s price](docs.stripe.com/billing/subscriptions/change-price#changing).



472
473
474
# File 'lib/stripe/params/subscription_update_params.rb', line 472

def id
  @id
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`.



474
475
476
# File 'lib/stripe/params/subscription_update_params.rb', line 474

def 
  @metadata
end

#planObject

Plan ID for this item, as a string.



476
477
478
# File 'lib/stripe/params/subscription_update_params.rb', line 476

def plan
  @plan
end

#priceObject

The ID of the price object. One of ‘price` or `price_data` is required. When changing a subscription item’s price, ‘quantity` is set to 1 unless a `quantity` parameter is provided.



478
479
480
# File 'lib/stripe/params/subscription_update_params.rb', line 478

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.



480
481
482
# File 'lib/stripe/params/subscription_update_params.rb', line 480

def price_data
  @price_data
end

#quantityObject

Quantity for this item.



482
483
484
# File 'lib/stripe/params/subscription_update_params.rb', line 482

def quantity
  @quantity
end

#tax_ratesObject

A list of [Tax Rate](docs.stripe.com/api/tax_rates) ids. These Tax Rates will override the [‘default_tax_rates`](docs.stripe.com/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.



484
485
486
# File 'lib/stripe/params/subscription_update_params.rb', line 484

def tax_rates
  @tax_rates
end

Class Method Details

.field_encodingsObject



514
515
516
517
518
# File 'lib/stripe/params/subscription_update_params.rb', line 514

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