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 in **basis points** (e.g. ‘540` means `5.4%`, `10000` means `100%`).
-
#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.
-
#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 78
|
Instance Attribute Details
#amount ⇒ Integer
The discount amount in **basis points** (e.g. ‘540` means `5.4%`, `10000` means `100%`).
Must be at least 1.
17 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 17 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.
32 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 32 optional :code, String, nil?: true |
#expires_at ⇒ Time?
When the discount expires, if ever.
38 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 38 optional :expires_at, Time, nil?: true |
#metadata ⇒ Hash{Symbol=>String}?
Additional metadata for the discount
44 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 44 optional :metadata, Dodopayments::Internal::Type::HashOf[String] |
#name ⇒ String?
49 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 49 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)
56 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 56 optional :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean |
#restricted_to ⇒ Array<String>?
List of product IDs to restrict usage (if any).
62 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 62 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.
70 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 70 optional :subscription_cycles, Integer, nil?: true |
#type ⇒ Symbol, Dodopayments::Models::DiscountType
The discount type. Currently only ‘percentage` is supported.
23 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 23 required :type, enum: -> { Dodopayments::DiscountType } |
#usage_limit ⇒ Integer?
How many times this discount can be used (if any). Must be >= 1 if provided.
76 |
# File 'lib/dodopayments/models/discount_create_params.rb', line 76 optional :usage_limit, Integer, nil?: true |