Class: Dodopayments::Models::DiscountCreateParams
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- Dodopayments::Models::DiscountCreateParams
- Extended by:
- Internal::Type::RequestParameters::Converter
- Includes:
- Internal::Type::RequestParameters
- Defined in:
- lib/dodopayments/models/discount_create_params.rb
Overview
Instance Attribute Summary collapse
-
#amount ⇒ Integer
The discount amount.
-
#code ⇒ String?
Optionally supply a code (will be uppercased).
-
#expires_at ⇒ Time?
When the discount expires, if ever.
-
#metadata ⇒ Hash{Symbol=>String}?
Additional metadata for the discount.
- #name ⇒ String?
-
#preserve_on_plan_change ⇒ Boolean?
Whether this discount should be preserved when a subscription changes plans.
-
#restricted_to ⇒ Array<String>?
List of product IDs to restrict usage (if any).
-
#subscription_cycles ⇒ Integer?
Number of subscription billing cycles this discount is valid for.
-
#type ⇒ Symbol, Dodopayments::Models::DiscountType
The discount type (e.g. ‘percentage`, `flat`, or `flat_per_unit`).
-
#usage_limit ⇒ Integer?
How many times this discount can be used (if any).
Attributes included from Internal::Type::RequestParameters
Instance Method Summary collapse
-
#initialize(amount:, type:, code: nil, expires_at: nil, metadata: nil, name: nil, preserve_on_plan_change: nil, restricted_to: nil, subscription_cycles: nil, usage_limit: nil, request_options: {}) ⇒ Object
constructor
Some parameter documentations has been truncated, see DiscountCreateParams for more details.
Methods included from Internal::Type::RequestParameters::Converter
Methods included from Internal::Type::RequestParameters
Methods inherited from Internal::Type::BaseModel
==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml
Methods included from Internal::Type::Converter
#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info
Methods included from Internal::Util::SorbetRuntimeSupport
#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type
Constructor Details
#initialize(amount:, type:, code: nil, expires_at: nil, metadata: nil, name: nil, preserve_on_plan_change: nil, restricted_to: nil, subscription_cycles: nil, usage_limit: nil, request_options: {}) ⇒ Object
Some parameter documentations has been truncated, see Dodopayments::Models::DiscountCreateParams for more details.
|
|
# File 'lib/dodopayments/models/discount_create_params.rb', line 82
|
Instance Attribute Details
#amount ⇒ Integer
The discount amount.
-
If ‘discount_type` is not `percentage`, `amount` is in **USD cents**. For example, `100` means `$1.00`. Only USD is allowed.
-
If ‘discount_type` is `percentage`, `amount` is in **basis points**. For example, `540` means `5.4%`.
Must be at least 1.
21 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 21 required :amount, Integer |
#code ⇒ String?
Optionally supply a code (will be uppercased).
-
Must be at least 3 characters if provided.
-
If omitted, a random 16-character code is generated.
36 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 36 optional :code, String, nil?: true |
#expires_at ⇒ Time?
When the discount expires, if ever.
42 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 42 optional :expires_at, Time, nil?: true |
#metadata ⇒ Hash{Symbol=>String}?
Additional metadata for the discount
48 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 48 optional :metadata, Dodopayments::Internal::Type::HashOf[String] |
#name ⇒ String?
53 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 53 optional :name, String, nil?: true |
#preserve_on_plan_change ⇒ Boolean?
Whether this discount should be preserved when a subscription changes plans. Default: false (discount is removed on plan change)
60 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 60 optional :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean |
#restricted_to ⇒ Array<String>?
List of product IDs to restrict usage (if any).
66 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 66 optional :restricted_to, Dodopayments::Internal::Type::ArrayOf[String], nil?: true |
#subscription_cycles ⇒ Integer?
Number of subscription billing cycles this discount is valid for. If not provided, the discount will be applied indefinitely to all recurring payments related to the subscription.
74 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 74 optional :subscription_cycles, Integer, nil?: true |
#type ⇒ Symbol, Dodopayments::Models::DiscountType
The discount type (e.g. ‘percentage`, `flat`, or `flat_per_unit`).
27 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 27 required :type, enum: -> { Dodopayments::DiscountType } |
#usage_limit ⇒ Integer?
How many times this discount can be used (if any). Must be >= 1 if provided.
80 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 80 optional :usage_limit, Integer, nil?: true |