Class: Stripe::Checkout::Session::UpdateParams::Discount::CouponData

Inherits:
RequestParams
  • Object
show all
Defined in:
lib/stripe/resources/checkout/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

#to_h

Constructor Details

#initialize(amount_off: nil, currency: nil, duration: nil, metadata: nil, name: nil, percent_off: nil) ⇒ CouponData

Returns a new instance of CouponData.



3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
# File 'lib/stripe/resources/checkout/session.rb', line 3599

def initialize(
  amount_off: nil,
  currency: nil,
  duration: nil,
  metadata: nil,
  name: nil,
  percent_off: nil
)
  @amount_off = amount_off
  @currency = currency
  @duration = duration
  @metadata = 
  @name = name
  @percent_off = percent_off
end

Instance Attribute Details

#amount_offObject

A positive integer representing the amount to subtract from an invoice total (required if ‘percent_off` is not passed).



3587
3588
3589
# File 'lib/stripe/resources/checkout/session.rb', line 3587

def amount_off
  @amount_off
end

#currencyObject

Three-letter [ISO code for the currency](stripe.com/docs/currencies) of the ‘amount_off` parameter (required if `amount_off` is passed).



3589
3590
3591
# File 'lib/stripe/resources/checkout/session.rb', line 3589

def currency
  @currency
end

#durationObject

Specifies how long the discount will be in effect if used on a subscription. Defaults to ‘once`.



3591
3592
3593
# File 'lib/stripe/resources/checkout/session.rb', line 3591

def duration
  @duration
end

#metadataObject

Set of [key-value pairs](stripe.com/docs/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`.



3593
3594
3595
# File 'lib/stripe/resources/checkout/session.rb', line 3593

def 
  @metadata
end

#nameObject

Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the ‘id` is shown if `name` is not set.



3595
3596
3597
# File 'lib/stripe/resources/checkout/session.rb', line 3595

def name
  @name
end

#percent_offObject

A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if ‘amount_off` is not passed).



3597
3598
3599
# File 'lib/stripe/resources/checkout/session.rb', line 3597

def percent_off
  @percent_off
end