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](api.stripe.com#coupons) or [promotion code](api.stripe.com#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](docs.stripe.com/billing/subscriptions/discounts)
Defined Under Namespace
Classes: ServicePeriodDetails, 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.
-
#customer_account ⇒ Object
readonly
The ID of the account representing 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.
-
#schedule ⇒ Object
readonly
The subscription schedule that this coupon is applied to, if it is applied to a particular subscription schedule.
-
#service_period_details ⇒ Object
readonly
Attribute for field service_period_details.
-
#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?, field_encodings, #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.
45 46 47 |
# File 'lib/stripe/resources/discount.rb', line 45 def checkout_session @checkout_session end |
#customer ⇒ Object (readonly)
The ID of the customer associated with this discount.
47 48 49 |
# File 'lib/stripe/resources/discount.rb', line 47 def customer @customer end |
#customer_account ⇒ Object (readonly)
The ID of the account representing the customer associated with this discount.
49 50 51 |
# File 'lib/stripe/resources/discount.rb', line 49 def customer_account @customer_account end |
#deleted ⇒ Object (readonly)
Always true for a deleted object
75 76 77 |
# File 'lib/stripe/resources/discount.rb', line 75 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.
51 52 53 |
# File 'lib/stripe/resources/discount.rb', line 51 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.
53 54 55 |
# File 'lib/stripe/resources/discount.rb', line 53 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.
55 56 57 |
# File 'lib/stripe/resources/discount.rb', line 55 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.
57 58 59 |
# File 'lib/stripe/resources/discount.rb', line 57 def invoice_item @invoice_item end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
59 60 61 |
# File 'lib/stripe/resources/discount.rb', line 59 def object @object end |
#promotion_code ⇒ Object (readonly)
The promotion code applied to create this discount.
61 62 63 |
# File 'lib/stripe/resources/discount.rb', line 61 def promotion_code @promotion_code end |
#schedule ⇒ Object (readonly)
The subscription schedule that this coupon is applied to, if it is applied to a particular subscription schedule.
63 64 65 |
# File 'lib/stripe/resources/discount.rb', line 63 def schedule @schedule end |
#service_period_details ⇒ Object (readonly)
Attribute for field service_period_details
65 66 67 |
# File 'lib/stripe/resources/discount.rb', line 65 def service_period_details @service_period_details end |
#source ⇒ Object (readonly)
Attribute for field source
67 68 69 |
# File 'lib/stripe/resources/discount.rb', line 67 def source @source end |
#start ⇒ Object (readonly)
Date that the coupon was applied.
69 70 71 |
# File 'lib/stripe/resources/discount.rb', line 69 def start @start end |
#subscription ⇒ Object (readonly)
The subscription that this coupon is applied to, if it is applied to a particular subscription.
71 72 73 |
# File 'lib/stripe/resources/discount.rb', line 71 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.
73 74 75 |
# File 'lib/stripe/resources/discount.rb', line 73 def subscription_item @subscription_item end |
Class Method Details
.field_remappings ⇒ Object
81 82 83 |
# File 'lib/stripe/resources/discount.rb', line 81 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
77 78 79 |
# File 'lib/stripe/resources/discount.rb', line 77 def self.inner_class_types @inner_class_types = { service_period_details: ServicePeriodDetails, source: Source } end |
.object_name ⇒ Object
11 12 13 |
# File 'lib/stripe/resources/discount.rb', line 11 def self.object_name "discount" end |