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)
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.
-
#coupon ⇒ Object
readonly
A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.
-
#customer ⇒ Object
readonly
The ID of the customer associated with this discount.
-
#customer_account ⇒ Object
readonly
The ID of the account 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.
-
#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
#==, #[], #[]=, 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.
16 17 18 |
# File 'lib/stripe/resources/discount.rb', line 16 def checkout_session @checkout_session end |
#coupon ⇒ Object (readonly)
A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to [subscriptions](stripe.com/docs/api#subscriptions), [invoices](stripe.com/docs/api#invoices), [checkout sessions](stripe.com/docs/api/checkout/sessions), [quotes](stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](stripe.com/docs/api#create_charge) or [payment intents](stripe.com/docs/api/payment_intents).
20 21 22 |
# File 'lib/stripe/resources/discount.rb', line 20 def coupon @coupon end |
#customer ⇒ Object (readonly)
The ID of the customer associated with this discount.
22 23 24 |
# File 'lib/stripe/resources/discount.rb', line 22 def customer @customer end |
#customer_account ⇒ Object (readonly)
The ID of the account associated with this discount.
24 25 26 |
# File 'lib/stripe/resources/discount.rb', line 24 def customer_account @customer_account end |
#deleted ⇒ Object (readonly)
Always true for a deleted object
44 45 46 |
# File 'lib/stripe/resources/discount.rb', line 44 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.
26 27 28 |
# File 'lib/stripe/resources/discount.rb', line 26 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.
28 29 30 |
# File 'lib/stripe/resources/discount.rb', line 28 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.
30 31 32 |
# File 'lib/stripe/resources/discount.rb', line 30 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.
32 33 34 |
# File 'lib/stripe/resources/discount.rb', line 32 def invoice_item @invoice_item end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
34 35 36 |
# File 'lib/stripe/resources/discount.rb', line 34 def object @object end |
#promotion_code ⇒ Object (readonly)
The promotion code applied to create this discount.
36 37 38 |
# File 'lib/stripe/resources/discount.rb', line 36 def promotion_code @promotion_code end |
#start ⇒ Object (readonly)
Date that the coupon was applied.
38 39 40 |
# File 'lib/stripe/resources/discount.rb', line 38 def start @start end |
#subscription ⇒ Object (readonly)
The subscription that this coupon is applied to, if it is applied to a particular subscription.
40 41 42 |
# File 'lib/stripe/resources/discount.rb', line 40 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.
42 43 44 |
# File 'lib/stripe/resources/discount.rb', line 42 def subscription_item @subscription_item end |
Class Method Details
.object_name ⇒ Object
11 12 13 |
# File 'lib/stripe/resources/discount.rb', line 11 def self.object_name "discount" end |