Class: Stripe::Discount
- Inherits:
-
StripeObject
- Object
- StripeObject
- Stripe::Discount
- Defined in:
- lib/stripe/resources/discount.rb
Overview
A discount represents the actual application of a [coupon](stripe.com/docs/api#coupons) or [promotion code](stripe.com/docs/api#promotion_codes). It contains information about when the discount began, when it will end, and what it is applied to.
Related guide: [Applying discounts to subscriptions](stripe.com/docs/billing/subscriptions/discounts)
Defined Under Namespace
Classes: Source
Constant Summary collapse
- OBJECT_NAME =
"discount"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#checkout_session ⇒ Object
readonly
The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode.
-
#customer ⇒ Object
readonly
The ID of the customer associated with this discount.
-
#deleted ⇒ Object
readonly
Always true for a deleted object.
-
#end ⇒ Object
readonly
If the coupon has a duration of ‘repeating`, the date that this discount will end.
-
#id ⇒ Object
readonly
The ID of the discount object.
-
#invoice ⇒ Object
readonly
The invoice that the discount’s coupon was applied to, if it was applied directly to a particular invoice.
-
#invoice_item ⇒ Object
readonly
The invoice item ‘id` (or invoice line item `id` for invoice line items of type=’subscription’) that the discount’s coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#promotion_code ⇒ Object
readonly
The promotion code applied to create this discount.
-
#source ⇒ Object
readonly
Attribute for field source.
-
#start ⇒ Object
readonly
Date that the coupon was applied.
-
#subscription ⇒ Object
readonly
The subscription that this coupon is applied to, if it is applied to a particular subscription.
-
#subscription_item ⇒ Object
readonly
The subscription item that this coupon is applied to, if it is applied to a particular subscription item.
Attributes inherited from StripeObject
Class Method Summary collapse
Methods inherited from StripeObject
#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Instance Attribute Details
#checkout_session ⇒ Object (readonly)
The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode. Will not be present for subscription mode.
30 31 32 |
# File 'lib/stripe/resources/discount.rb', line 30 def checkout_session @checkout_session end |
#customer ⇒ Object (readonly)
The ID of the customer associated with this discount.
32 33 34 |
# File 'lib/stripe/resources/discount.rb', line 32 def customer @customer end |
#deleted ⇒ Object (readonly)
Always true for a deleted object
54 55 56 |
# File 'lib/stripe/resources/discount.rb', line 54 def deleted @deleted end |
#end ⇒ Object (readonly)
If the coupon has a duration of ‘repeating`, the date that this discount will end. If the coupon has a duration of `once` or `forever`, this attribute will be null.
34 35 36 |
# File 'lib/stripe/resources/discount.rb', line 34 def end @end end |
#id ⇒ Object (readonly)
The ID of the discount object. Discounts cannot be fetched by ID. Use ‘expand[]=discounts` in API calls to expand discount IDs in an array.
36 37 38 |
# File 'lib/stripe/resources/discount.rb', line 36 def id @id end |
#invoice ⇒ Object (readonly)
The invoice that the discount’s coupon was applied to, if it was applied directly to a particular invoice.
38 39 40 |
# File 'lib/stripe/resources/discount.rb', line 38 def invoice @invoice end |
#invoice_item ⇒ Object (readonly)
The invoice item ‘id` (or invoice line item `id` for invoice line items of type=’subscription’) that the discount’s coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
40 41 42 |
# File 'lib/stripe/resources/discount.rb', line 40 def invoice_item @invoice_item end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
42 43 44 |
# File 'lib/stripe/resources/discount.rb', line 42 def object @object end |
#promotion_code ⇒ Object (readonly)
The promotion code applied to create this discount.
44 45 46 |
# File 'lib/stripe/resources/discount.rb', line 44 def promotion_code @promotion_code end |
#source ⇒ Object (readonly)
Attribute for field source
46 47 48 |
# File 'lib/stripe/resources/discount.rb', line 46 def source @source end |
#start ⇒ Object (readonly)
Date that the coupon was applied.
48 49 50 |
# File 'lib/stripe/resources/discount.rb', line 48 def start @start end |
#subscription ⇒ Object (readonly)
The subscription that this coupon is applied to, if it is applied to a particular subscription.
50 51 52 |
# File 'lib/stripe/resources/discount.rb', line 50 def subscription @subscription end |
#subscription_item ⇒ Object (readonly)
The subscription item that this coupon is applied to, if it is applied to a particular subscription item.
52 53 54 |
# File 'lib/stripe/resources/discount.rb', line 52 def subscription_item @subscription_item end |
Class Method Details
.field_remappings ⇒ Object
60 61 62 |
# File 'lib/stripe/resources/discount.rb', line 60 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
56 57 58 |
# File 'lib/stripe/resources/discount.rb', line 56 def self.inner_class_types @inner_class_types = { source: Source } end |
.object_name ⇒ Object
11 12 13 |
# File 'lib/stripe/resources/discount.rb', line 11 def self.object_name "discount" end |