Class: Dodopayments::Models::UpdateSubscriptionPlanReq

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/dodopayments/models/update_subscription_plan_req.rb,
sig/dodopayments/models/update_subscription_plan_req.rbs

Defined Under Namespace

Modules: EffectiveAt, OnPaymentFailure, ProrationBillingMode

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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(product_id:, proration_billing_mode:, quantity:, adaptive_currency_fees_inclusive: nil, addons: nil, discount_code: nil, discount_codes: nil, effective_at: nil, metadata: nil, on_payment_failure: nil) ⇒ Object

Some parameter documentations has been truncated, see Dodopayments::Models::UpdateSubscriptionPlanReq for more details.

Parameters:

  • product_id (String)

    Unique identifier of the product to subscribe to

  • proration_billing_mode (Symbol, Dodopayments::Models::UpdateSubscriptionPlanReq::ProrationBillingMode)

    Proration Billing Mode

  • quantity (Integer)

    Number of units to subscribe for. Must be at least 1.

  • adaptive_currency_fees_inclusive (Boolean, nil) (defaults to: nil)

    Whether adaptive currency fees should be included in the price (true) or added o

  • addons (Array<Dodopayments::Models::AttachAddon>, nil) (defaults to: nil)

    Addons for the new plan.

  • discount_code (String, nil) (defaults to: nil)

    DEPRECATED: Use discount_codes instead. Cannot be used together with discount_co

  • discount_codes (Array<String>, nil) (defaults to: nil)

    Stacked discount codes to apply to the new plan. Max 20.

  • effective_at (Symbol, Dodopayments::Models::UpdateSubscriptionPlanReq::EffectiveAt) (defaults to: nil)

    When to apply the plan change.

  • metadata (Hash{Symbol=>String, Float, Boolean}, nil) (defaults to: nil)

    Metadata for the payment. If not passed, the metadata of the subscription will b

  • on_payment_failure (Symbol, Dodopayments::Models::UpdateSubscriptionPlanReq::OnPaymentFailure, nil) (defaults to: nil)

    Controls behavior when the plan change payment fails.



# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 89

Instance Attribute Details

#adaptive_currency_fees_inclusiveBoolean?

Whether adaptive currency fees should be included in the price (true) or added on top (false). If not specified, uses the subscription's stored setting.

Parameters:

  • value (Boolean, nil)

Returns:

  • (Boolean, nil)


30
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 30

optional :adaptive_currency_fees_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true

#addonsArray<Dodopayments::Models::AttachAddon>?

Addons for the new plan. Note : Leaving this empty would remove any existing addons

Parameters:

Returns:



37
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 37

optional :addons, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::AttachAddon] }, nil?: true

#discount_codeString?

Deprecated.

Use discount_id instead.

DEPRECATED: Use discount_codes instead. Cannot be used together with discount_codes.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


46
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 46

optional :discount_code, String, nil?: true

#discount_codesArray<String>?

Stacked discount codes to apply to the new plan. Max 20. Cannot be used together with discount_code. If provided, replaces any existing discount codes. Empty array removes all discounts. If not provided (None), existing discounts with preserve_on_plan_change=true are preserved.

Parameters:

  • value (::Array[String], nil)

Returns:

  • (Array<String>, nil)


55
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 55

optional :discount_codes, Dodopayments::Internal::Type::ArrayOf[String], nil?: true

#effective_atSymbol, ...

When to apply the plan change.

  • immediately (default): Apply the plan change right away
  • next_billing_date: Schedule the change for the next billing date


64
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 64

optional :effective_at, enum: -> { Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt }

#metadataHash{Symbol=>String, Float, Boolean}?

Metadata for the payment. If not passed, the metadata of the subscription will be taken

Parameters:

  • value (Dodopayments::Models::metadata, nil)

Returns:

  • (Hash{Symbol=>String, Float, Boolean}, nil)


71
72
73
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 71

optional :metadata,
-> { Dodopayments::Internal::Type::HashOf[union: Dodopayments::MetadataItem] },
nil?: true

#on_payment_failureSymbol, ...

Controls behavior when the plan change payment fails.

  • prevent_change: Keep subscription on current plan until payment succeeds
  • apply_change (default): Apply plan change immediately regardless of payment outcome

If not specified, uses the business-level default setting.

Parameters:

  • value (Dodopayments::Models::UpdateSubscriptionPlanReq::on_payment_failure, nil)

Returns:



85
86
87
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 85

optional :on_payment_failure,
enum: -> { Dodopayments::UpdateSubscriptionPlanReq::OnPaymentFailure },
nil?: true

#product_idString

Unique identifier of the product to subscribe to

Parameters:

  • value (String)

Returns:

  • (String)


10
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 10

required :product_id, String

#proration_billing_modeSymbol, Dodopayments::Models::UpdateSubscriptionPlanReq::ProrationBillingMode

Proration Billing Mode

Parameters:

  • value (Dodopayments::Models::UpdateSubscriptionPlanReq::proration_billing_mode)

Returns:



16
17
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 16

required :proration_billing_mode,
enum: -> { Dodopayments::UpdateSubscriptionPlanReq::ProrationBillingMode }

#quantityInteger

Number of units to subscribe for. Must be at least 1.

Parameters:

  • value (Integer)

Returns:

  • (Integer)


23
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 23

required :quantity, Integer

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 124

Instance Method Details

#to_hash{

Returns:

  • ({)


55
# File 'sig/dodopayments/models/update_subscription_plan_req.rbs', line 55

def to_hash: -> {