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, cancel_scheduled_change_plan: nil, collect_via_payment_link: 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.

  • cancel_scheduled_change_plan (Boolean) (defaults to: nil)

    Replace a scheduled plan change with this one.

  • collect_via_payment_link (Boolean) (defaults to: nil)

    Collect the plan-change amount with a payment link. The customer then

  • 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 119

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

#cancel_scheduled_change_planBoolean?

Replace a scheduled plan change with this one.

The scheduled change is cancelled by the transaction that applies this change. A change that never applies leaves the schedule in place.

effective_at: next_billing_date is allowed. The new schedule then replaces the old one in the request transaction.

A pending plan change still gets a 409. This field does not affect it.

The preview route shares this request body, so a preview that sets this field also passes the scheduled-change 409.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


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

optional :cancel_scheduled_change_plan, Dodopayments::Internal::Type::Boolean

Collect the plan-change amount with a payment link. The customer then pays on a checkout page.

The business needs the allow_plan_change_via_payment_link capability. The request needs effective_at: immediately. The request also needs on_payment_failure: prevent_change.

The preview route shares this request body and ignores this field.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


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

optional :collect_via_payment_link, Dodopayments::Internal::Type::Boolean

#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)


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

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)


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

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


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

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)


101
102
103
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 101

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:



115
116
117
# File 'lib/dodopayments/models/update_subscription_plan_req.rb', line 115

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 158

Instance Method Details

#to_hash{

Returns:

  • ({)


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

def to_hash: -> {