dodopayments 2.25.0 → 2.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6044c5e4d1ea9b8f78276bedf6e3218cb525ae8163a52089a05261e227cfd4c6
4
- data.tar.gz: db3411ebc0c7020505e250983d0d7eb65061c6f84341aca6230101142ccce20a
3
+ metadata.gz: e8b7cafc248338a4ade0c7286d952538e01a9bf5d37c8055a00334dcadf4f704
4
+ data.tar.gz: f09302d55a6bb456e7be074623b1028461b3f2a06be0a473c20861ef5ee72009
5
5
  SHA512:
6
- metadata.gz: b98146146080c8330a6990c0109609b568bf3f8b5181f995d65a89a5417eb841dc09294c50f3cfaabb1c4be743a725d44eacd8f072bb82949178d4d6e94df18d
7
- data.tar.gz: 13bbf24a4ed0f809f279588f79f3f422c2c18cdb7bb28717164e5f088c42ffe032da03178c164a73f4179671a83bd7c10a379bfaddb402a03dd89453d16583a4
6
+ metadata.gz: e1eb4476c66201ce9fcc8f9c64604d33fa1f725f48f267683559a73657bf36f6a9572a8ae45290f3f0a92a2eb939e5fd30eecd7e6067d92d76196774cd24b3d5
7
+ data.tar.gz: 1a5f5a769335be408661bd207290c2c54f0cc8a93f8df439566d7cc49b2b643b2a84319f933ba7892fb0bf0f17733f7ec899c5ce0e42b3dffb289dc1c5d28475
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.26.0](https://github.com/dodopayments/dodopayments-ruby/compare/v2.25.0...v2.26.0) (2026-08-24)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** return checkout handles from subscription change-plan ([2214ac1](https://github.com/dodopayments/dodopayments-ruby/commit/2214ac15c534b4f0f0dd3bd99b54d7ea3a902ef1))
9
+ * **api:** return checkout handles from subscription change-plan ([33a5304](https://github.com/dodopayments/dodopayments-ruby/commit/33a5304d28904f9cb0d6bfc3e60a4765925c308a))
10
+
3
11
  ## [2.25.0](https://github.com/dodopayments/dodopayments-ruby/compare/v2.24.0...v2.25.0) (2026-08-17)
4
12
 
5
13
 
data/README.md CHANGED
@@ -23,7 +23,7 @@ To use this gem, install via Bundler by adding the following to your application
23
23
  <!-- x-release-please-start-version -->
24
24
 
25
25
  ```ruby
26
- gem "dodopayments", "~> 2.25.0"
26
+ gem "dodopayments", "~> 2.26.0"
27
27
  ```
28
28
 
29
29
  <!-- x-release-please-end -->
@@ -4,8 +4,15 @@ module Dodopayments
4
4
  module Models
5
5
  module Entitlements
6
6
  class LicenseKeyGrant < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # Identifier of the issued license key.
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
7
13
  # @!attribute activations_used
8
- # Number of activations consumed so far.
14
+ # Number of instances currently active. Activation increments it and deactivation
15
+ # decrements it, so it is a live count and not a total.
9
16
  #
10
17
  # @return [Integer]
11
18
  required :activations_used, Integer
@@ -16,6 +23,13 @@ module Dodopayments
16
23
  # @return [String]
17
24
  required :key, String
18
25
 
26
+ # @!attribute status
27
+ # Current status of the license key. Activation fails unless it is `active`, so a
28
+ # client can warn before the customer tries.
29
+ #
30
+ # @return [Symbol, Dodopayments::Models::LicenseKeyStatus]
31
+ required :status, enum: -> { Dodopayments::LicenseKeyStatus }
32
+
19
33
  # @!attribute activations_limit
20
34
  # Maximum activations allowed by the entitlement, when set.
21
35
  #
@@ -28,14 +42,21 @@ module Dodopayments
28
42
  # @return [Time, nil]
29
43
  optional :expires_at, Time, nil?: true
30
44
 
31
- # @!method initialize(activations_used:, key:, activations_limit: nil, expires_at: nil)
45
+ # @!method initialize(id:, activations_used:, key:, status:, activations_limit: nil, expires_at: nil)
46
+ # Some parameter documentations has been truncated, see
47
+ # {Dodopayments::Models::Entitlements::LicenseKeyGrant} for more details.
48
+ #
32
49
  # License-key delivery payload, present on grants for `license_key` entitlements.
33
50
  # The grant's top-level `status` is the source of truth for the grant's lifecycle.
34
51
  #
35
- # @param activations_used [Integer] Number of activations consumed so far.
52
+ # @param id [String] Identifier of the issued license key.
53
+ #
54
+ # @param activations_used [Integer] Number of instances currently active. Activation increments it and
36
55
  #
37
56
  # @param key [String] Issued license key.
38
57
  #
58
+ # @param status [Symbol, Dodopayments::Models::LicenseKeyStatus] Current status of the license key. Activation fails unless it is
59
+ #
39
60
  # @param activations_limit [Integer, nil] Maximum activations allowed by the entitlement, when set.
40
61
  #
41
62
  # @param expires_at [Time, nil] When the license key expires, when applicable.
@@ -40,13 +40,6 @@ module Dodopayments
40
40
  # @return [Integer]
41
41
  required :price, Integer
42
42
 
43
- # @!attribute purchasing_power_parity
44
- # Indicates if purchasing power parity adjustments are applied to the price.
45
- # Purchasing power parity feature is not available as of now.
46
- #
47
- # @return [Boolean]
48
- required :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
49
-
50
43
  # @!attribute type
51
44
  #
52
45
  # @return [Symbol, :one_time_price]
@@ -59,6 +52,14 @@ module Dodopayments
59
52
  # @return [Boolean, nil]
60
53
  optional :pay_what_you_want, Dodopayments::Internal::Type::Boolean
61
54
 
55
+ # @!attribute purchasing_power_parity
56
+ # Opts this price in to purchasing power parity. The business must also enable
57
+ # purchasing power parity. The discount percentage per country is always
58
+ # business-wide. Defaults to `false`.
59
+ #
60
+ # @return [Boolean, nil]
61
+ optional :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
62
+
62
63
  # @!attribute suggested_price
63
64
  # A suggested price for the user to pay. This value is only considered if
64
65
  # [`pay_what_you_want`](Self::pay_what_you_want) is `true`. Otherwise, it is
@@ -73,7 +74,7 @@ module Dodopayments
73
74
  # @return [Boolean, nil]
74
75
  optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
75
76
 
76
- # @!method initialize(currency:, discount:, price:, purchasing_power_parity:, pay_what_you_want: nil, suggested_price: nil, tax_inclusive: nil, type: :one_time_price)
77
+ # @!method initialize(currency:, discount:, price:, pay_what_you_want: nil, purchasing_power_parity: nil, suggested_price: nil, tax_inclusive: nil, type: :one_time_price)
77
78
  # Some parameter documentations has been truncated, see
78
79
  # {Dodopayments::Models::Price::OneTimePrice} for more details.
79
80
  #
@@ -85,10 +86,10 @@ module Dodopayments
85
86
  #
86
87
  # @param price [Integer] The payment amount, in the smallest denomination of the currency (e.g., cents fo
87
88
  #
88
- # @param purchasing_power_parity [Boolean] Indicates if purchasing power parity adjustments are applied to the price.
89
- #
90
89
  # @param pay_what_you_want [Boolean] Indicates whether the customer can pay any amount they choose.
91
90
  #
91
+ # @param purchasing_power_parity [Boolean] Opts this price in to purchasing power parity. The business must also
92
+ #
92
93
  # @param suggested_price [Integer, nil] A suggested price for the user to pay. This value is only considered if
93
94
  #
94
95
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive.
@@ -129,13 +130,6 @@ module Dodopayments
129
130
  # @return [Integer]
130
131
  required :price, Integer
131
132
 
132
- # @!attribute purchasing_power_parity
133
- # Indicates if purchasing power parity adjustments are applied to the price.
134
- # Purchasing power parity feature is not available as of now
135
- #
136
- # @return [Boolean]
137
- required :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
138
-
139
133
  # @!attribute subscription_period_count
140
134
  # Number of units for the subscription period. For example, a value of `12` with a
141
135
  # `subscription_period_interval` of `month` represents a one-year subscription.
@@ -154,6 +148,14 @@ module Dodopayments
154
148
  # @return [Symbol, :recurring_price]
155
149
  required :type, const: :recurring_price
156
150
 
151
+ # @!attribute purchasing_power_parity
152
+ # Opts this price in to purchasing power parity. The business must also enable
153
+ # purchasing power parity. The discount percentage per country is always
154
+ # business-wide. Defaults to `false`.
155
+ #
156
+ # @return [Boolean, nil]
157
+ optional :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
158
+
157
159
  # @!attribute tax_inclusive
158
160
  # Indicates if the price is tax inclusive
159
161
  #
@@ -180,7 +182,7 @@ module Dodopayments
180
182
  # @return [Integer, nil]
181
183
  optional :trial_period_days, Integer
182
184
 
183
- # @!method initialize(currency:, discount:, payment_frequency_count:, payment_frequency_interval:, price:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, tax_inclusive: nil, trial_amount: nil, trial_apply_discounts: nil, trial_period_days: nil, type: :recurring_price)
185
+ # @!method initialize(currency:, discount:, payment_frequency_count:, payment_frequency_interval:, price:, subscription_period_count:, subscription_period_interval:, purchasing_power_parity: nil, tax_inclusive: nil, trial_amount: nil, trial_apply_discounts: nil, trial_period_days: nil, type: :recurring_price)
184
186
  # Some parameter documentations has been truncated, see
185
187
  # {Dodopayments::Models::Price::RecurringPrice} for more details.
186
188
  #
@@ -196,12 +198,12 @@ module Dodopayments
196
198
  #
197
199
  # @param price [Integer] The payment amount. Represented in the lowest denomination of the currency (e.g.
198
200
  #
199
- # @param purchasing_power_parity [Boolean] Indicates if purchasing power parity adjustments are applied to the price.
200
- #
201
201
  # @param subscription_period_count [Integer] Number of units for the subscription period.
202
202
  #
203
203
  # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
204
204
  #
205
+ # @param purchasing_power_parity [Boolean] Opts this price in to purchasing power parity. The business must also
206
+ #
205
207
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
206
208
  #
207
209
  # @param trial_amount [Integer, nil] Amount charged today for a paid trial, in the price currency's minor units.
@@ -246,13 +248,6 @@ module Dodopayments
246
248
  # @return [Symbol, Dodopayments::Models::TimeInterval]
247
249
  required :payment_frequency_interval, enum: -> { Dodopayments::TimeInterval }
248
250
 
249
- # @!attribute purchasing_power_parity
250
- # Indicates if purchasing power parity adjustments are applied to the price.
251
- # Purchasing power parity feature is not available as of now
252
- #
253
- # @return [Boolean]
254
- required :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
255
-
256
251
  # @!attribute subscription_period_count
257
252
  # Number of units for the subscription period. For example, a value of `12` with a
258
253
  # `subscription_period_interval` of `month` represents a one-year subscription.
@@ -280,13 +275,22 @@ module Dodopayments
280
275
  },
281
276
  nil?: true
282
277
 
278
+ # @!attribute purchasing_power_parity
279
+ # Opts this price in to purchasing power parity. The business must also enable
280
+ # purchasing power parity. The discount percentage per country is always
281
+ # business-wide. Applies to the fixed fee only, never to metered usage. Defaults
282
+ # to `false`.
283
+ #
284
+ # @return [Boolean, nil]
285
+ optional :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
286
+
283
287
  # @!attribute tax_inclusive
284
288
  # Indicates if the price is tax inclusive
285
289
  #
286
290
  # @return [Boolean, nil]
287
291
  optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
288
292
 
289
- # @!method initialize(currency:, discount:, fixed_price:, payment_frequency_count:, payment_frequency_interval:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, meters: nil, tax_inclusive: nil, type: :usage_based_price)
293
+ # @!method initialize(currency:, discount:, fixed_price:, payment_frequency_count:, payment_frequency_interval:, subscription_period_count:, subscription_period_interval:, meters: nil, purchasing_power_parity: nil, tax_inclusive: nil, type: :usage_based_price)
290
294
  # Some parameter documentations has been truncated, see
291
295
  # {Dodopayments::Models::Price::UsageBasedPrice} for more details.
292
296
  #
@@ -302,14 +306,14 @@ module Dodopayments
302
306
  #
303
307
  # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the payment frequency (e.g., day, month, year).
304
308
  #
305
- # @param purchasing_power_parity [Boolean] Indicates if purchasing power parity adjustments are applied to the price.
306
- #
307
309
  # @param subscription_period_count [Integer] Number of units for the subscription period.
308
310
  #
309
311
  # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
310
312
  #
311
313
  # @param meters [Array<Dodopayments::Models::AddMeterToPrice>, nil]
312
314
  #
315
+ # @param purchasing_power_parity [Boolean] Opts this price in to purchasing power parity. The business must also
316
+ #
313
317
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
314
318
  #
315
319
  # @param type [Symbol, :usage_based_price]
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Subscriptions#change_plan
6
+ class SubscriptionChangePlanResponse < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute client_secret
8
+ # Client secret for an embedded checkout.
9
+ #
10
+ # @return [String, nil]
11
+ optional :client_secret, String, nil?: true
12
+
13
+ # @!attribute expires_on
14
+ # When the link stops working.
15
+ #
16
+ # @return [Time, nil]
17
+ optional :expires_on, Time, nil?: true
18
+
19
+ # @!attribute payment_id
20
+ # Id of the payment that settles the plan change.
21
+ #
22
+ # @return [String, nil]
23
+ optional :payment_id, String, nil?: true
24
+
25
+ # @!attribute payment_link
26
+ # Checkout page URL. Give this to the customer.
27
+ #
28
+ # @return [String, nil]
29
+ optional :payment_link, String, nil?: true
30
+
31
+ # @!method initialize(client_secret: nil, expires_on: nil, payment_id: nil, payment_link: nil)
32
+ # Handles for a hosted checkout page that settles a plan change.
33
+ #
34
+ # The four fields repeat `UpdatePaymentMethodResponse` and a subset of
35
+ # `CreateSubscriptionResponse`. A shared type would rename the generated SDK types
36
+ # for all three routes, so each route keeps its own.
37
+ #
38
+ # @param client_secret [String, nil] Client secret for an embedded checkout.
39
+ #
40
+ # @param expires_on [Time, nil] When the link stops working.
41
+ #
42
+ # @param payment_id [String, nil] Id of the payment that settles the plan change.
43
+ #
44
+ # @param payment_link [String, nil] Checkout page URL. Give this to the customer.
45
+ end
46
+ end
47
+ end
@@ -85,13 +85,25 @@ module Dodopayments
85
85
  optional :next_billing_date, Time, nil?: true
86
86
 
87
87
  # @!attribute pause
88
- # `Some(true)` pauses an active subscription; `Some(false)` unpauses a `Paused`
89
- # (or abandoned `OnHold`) subscription. Exclusive of every other field.
88
+ # Removed. Use `status: paused` to pause and `status: active` to resume. This
89
+ # field always fails with 422, so a caller still on it gets a loud error instead
90
+ # of a silent no-op.
90
91
  #
91
92
  # @return [Boolean, nil]
92
93
  optional :pause, Dodopayments::Internal::Type::Boolean, nil?: true
93
94
 
94
95
  # @!attribute status
96
+ # Set to `cancelled` to cancel the subscription. See `cancel_reason`,
97
+ # `cancellation_feedback`, `cancellation_comment`, and
98
+ # `cancel_at_next_billing_date` for cancellation options.
99
+ #
100
+ # Set to `paused` to pause an active subscription. Set to `active` to resume a
101
+ # `paused` subscription. `active` also resumes an `on_hold` subscription that has
102
+ # an unpaid pause invoice. This voids that invoice.
103
+ #
104
+ # Send `paused` or `active` alone. A request that combines either with any other
105
+ # field fails with 422. `cancelled` is not exclusive this way — see
106
+ # `cancel_reason` and friends below.
95
107
  #
96
108
  # @return [Symbol, Dodopayments::Models::SubscriptionStatus, nil]
97
109
  optional :status, enum: -> { Dodopayments::SubscriptionStatus }, nil?: true
@@ -146,9 +158,9 @@ module Dodopayments
146
158
  #
147
159
  # @param next_billing_date [Time, nil]
148
160
  #
149
- # @param pause [Boolean, nil] `Some(true)` pauses an active subscription; `Some(false)` unpauses a
161
+ # @param pause [Boolean, nil] Removed. Use `status: paused` to pause and `status: active` to resume.
150
162
  #
151
- # @param status [Symbol, Dodopayments::Models::SubscriptionStatus, nil]
163
+ # @param status [Symbol, Dodopayments::Models::SubscriptionStatus, nil] Set to `cancelled` to cancel the subscription. See `cancel_reason`,
152
164
  #
153
165
  # @param subscription_period_count [Integer, nil] New number of `subscription_period_interval` units the subscription
154
166
  #
@@ -36,6 +36,36 @@ module Dodopayments
36
36
  # @return [Array<Dodopayments::Models::AttachAddon>, nil]
37
37
  optional :addons, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::AttachAddon] }, nil?: true
38
38
 
39
+ # @!attribute cancel_scheduled_change_plan
40
+ # Replace a scheduled plan change with this one.
41
+ #
42
+ # The scheduled change is cancelled by the transaction that applies this change. A
43
+ # change that never applies leaves the schedule in place.
44
+ #
45
+ # `effective_at: next_billing_date` is allowed. The new schedule then replaces the
46
+ # old one in the request transaction.
47
+ #
48
+ # A pending plan change still gets a `409`. This field does not affect it.
49
+ #
50
+ # The preview route shares this request body, so a preview that sets this field
51
+ # also passes the scheduled-change `409`.
52
+ #
53
+ # @return [Boolean, nil]
54
+ optional :cancel_scheduled_change_plan, Dodopayments::Internal::Type::Boolean
55
+
56
+ # @!attribute collect_via_payment_link
57
+ # Collect the plan-change amount with a payment link. The customer then pays on a
58
+ # checkout page.
59
+ #
60
+ # The business needs the `allow_plan_change_via_payment_link` capability. The
61
+ # request needs `effective_at: immediately`. The request also needs
62
+ # `on_payment_failure: prevent_change`.
63
+ #
64
+ # The preview route shares this request body and ignores this field.
65
+ #
66
+ # @return [Boolean, nil]
67
+ optional :collect_via_payment_link, Dodopayments::Internal::Type::Boolean
68
+
39
69
  # @!attribute discount_code
40
70
  # @deprecated Use `discount_id` instead.
41
71
  #
@@ -86,7 +116,7 @@ module Dodopayments
86
116
  enum: -> { Dodopayments::UpdateSubscriptionPlanReq::OnPaymentFailure },
87
117
  nil?: true
88
118
 
89
- # @!method 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)
119
+ # @!method 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)
90
120
  # Some parameter documentations has been truncated, see
91
121
  # {Dodopayments::Models::UpdateSubscriptionPlanReq} for more details.
92
122
  #
@@ -100,6 +130,10 @@ module Dodopayments
100
130
  #
101
131
  # @param addons [Array<Dodopayments::Models::AttachAddon>, nil] Addons for the new plan.
102
132
  #
133
+ # @param cancel_scheduled_change_plan [Boolean] Replace a scheduled plan change with this one.
134
+ #
135
+ # @param collect_via_payment_link [Boolean] Collect the plan-change amount with a payment link. The customer then
136
+ #
103
137
  # @param discount_code [String, nil] DEPRECATED: Use discount_codes instead. Cannot be used together with discount_co
104
138
  #
105
139
  # @param discount_codes [Array<String>, nil] Stacked discount codes to apply to the new plan. Max 20.
@@ -121,9 +121,9 @@ module Dodopayments
121
121
  #
122
122
  # @param next_billing_date [Time, nil]
123
123
  #
124
- # @param pause [Boolean, nil] `Some(true)` pauses an active subscription; `Some(false)` unpauses a
124
+ # @param pause [Boolean, nil] Removed. Use `status: paused` to pause and `status: active` to resume.
125
125
  #
126
- # @param status [Symbol, Dodopayments::Models::SubscriptionStatus, nil]
126
+ # @param status [Symbol, Dodopayments::Models::SubscriptionStatus, nil] Set to `cancelled` to cancel the subscription. See `cancel_reason`,
127
127
  #
128
128
  # @param subscription_period_count [Integer, nil] New number of `subscription_period_interval` units the subscription
129
129
  #
@@ -209,7 +209,7 @@ module Dodopayments
209
209
  # Some parameter documentations has been truncated, see
210
210
  # {Dodopayments::Models::SubscriptionChangePlanParams} for more details.
211
211
  #
212
- # @overload change_plan(subscription_id, 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, request_options: {})
212
+ # @overload change_plan(subscription_id, 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, request_options: {})
213
213
  #
214
214
  # @param subscription_id [String] Subscription Id
215
215
  #
@@ -223,6 +223,10 @@ module Dodopayments
223
223
  #
224
224
  # @param addons [Array<Dodopayments::Models::AttachAddon>, nil] Addons for the new plan.
225
225
  #
226
+ # @param cancel_scheduled_change_plan [Boolean] Replace a scheduled plan change with this one.
227
+ #
228
+ # @param collect_via_payment_link [Boolean] Collect the plan-change amount with a payment link. The customer then
229
+ #
226
230
  # @param discount_code [String, nil] DEPRECATED: Use discount_codes instead. Cannot be used together with discount_co
227
231
  #
228
232
  # @param discount_codes [Array<String>, nil] Stacked discount codes to apply to the new plan. Max 20.
@@ -235,7 +239,7 @@ module Dodopayments
235
239
  #
236
240
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
237
241
  #
238
- # @return [nil]
242
+ # @return [Dodopayments::Models::SubscriptionChangePlanResponse]
239
243
  #
240
244
  # @see Dodopayments::Models::SubscriptionChangePlanParams
241
245
  def change_plan(subscription_id, params)
@@ -244,7 +248,7 @@ module Dodopayments
244
248
  method: :post,
245
249
  path: ["subscriptions/%1$s/change-plan", subscription_id],
246
250
  body: parsed,
247
- model: NilClass,
251
+ model: Dodopayments::Models::SubscriptionChangePlanResponse,
248
252
  options: options
249
253
  )
250
254
  end
@@ -287,7 +291,7 @@ module Dodopayments
287
291
  # Some parameter documentations has been truncated, see
288
292
  # {Dodopayments::Models::SubscriptionPreviewChangePlanParams} for more details.
289
293
  #
290
- # @overload preview_change_plan(subscription_id, 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, request_options: {})
294
+ # @overload preview_change_plan(subscription_id, 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, request_options: {})
291
295
  #
292
296
  # @param subscription_id [String] Subscription Id
293
297
  #
@@ -301,6 +305,10 @@ module Dodopayments
301
305
  #
302
306
  # @param addons [Array<Dodopayments::Models::AttachAddon>, nil] Addons for the new plan.
303
307
  #
308
+ # @param cancel_scheduled_change_plan [Boolean] Replace a scheduled plan change with this one.
309
+ #
310
+ # @param collect_via_payment_link [Boolean] Collect the plan-change amount with a payment link. The customer then
311
+ #
304
312
  # @param discount_code [String, nil] DEPRECATED: Use discount_codes instead. Cannot be used together with discount_co
305
313
  #
306
314
  # @param discount_codes [Array<String>, nil] Stacked discount codes to apply to the new plan. Max 20.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "2.25.0"
4
+ VERSION = "2.26.0"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -335,6 +335,7 @@ require_relative "dodopayments/models/subscription_active_webhook_event"
335
335
  require_relative "dodopayments/models/subscription_cancel_change_plan_params"
336
336
  require_relative "dodopayments/models/subscription_cancelled_webhook_event"
337
337
  require_relative "dodopayments/models/subscription_change_plan_params"
338
+ require_relative "dodopayments/models/subscription_change_plan_response"
338
339
  require_relative "dodopayments/models/subscription_charge_params"
339
340
  require_relative "dodopayments/models/subscription_charge_response"
340
341
  require_relative "dodopayments/models/subscription_create_params"
@@ -12,7 +12,12 @@ module Dodopayments
12
12
  )
13
13
  end
14
14
 
15
- # Number of activations consumed so far.
15
+ # Identifier of the issued license key.
16
+ sig { returns(String) }
17
+ attr_accessor :id
18
+
19
+ # Number of instances currently active. Activation increments it and deactivation
20
+ # decrements it, so it is a live count and not a total.
16
21
  sig { returns(Integer) }
17
22
  attr_accessor :activations_used
18
23
 
@@ -20,6 +25,11 @@ module Dodopayments
20
25
  sig { returns(String) }
21
26
  attr_accessor :key
22
27
 
28
+ # Current status of the license key. Activation fails unless it is `active`, so a
29
+ # client can warn before the customer tries.
30
+ sig { returns(Dodopayments::LicenseKeyStatus::TaggedSymbol) }
31
+ attr_accessor :status
32
+
23
33
  # Maximum activations allowed by the entitlement, when set.
24
34
  sig { returns(T.nilable(Integer)) }
25
35
  attr_accessor :activations_limit
@@ -32,17 +42,25 @@ module Dodopayments
32
42
  # The grant's top-level `status` is the source of truth for the grant's lifecycle.
33
43
  sig do
34
44
  params(
45
+ id: String,
35
46
  activations_used: Integer,
36
47
  key: String,
48
+ status: Dodopayments::LicenseKeyStatus::OrSymbol,
37
49
  activations_limit: T.nilable(Integer),
38
50
  expires_at: T.nilable(Time)
39
51
  ).returns(T.attached_class)
40
52
  end
41
53
  def self.new(
42
- # Number of activations consumed so far.
54
+ # Identifier of the issued license key.
55
+ id:,
56
+ # Number of instances currently active. Activation increments it and deactivation
57
+ # decrements it, so it is a live count and not a total.
43
58
  activations_used:,
44
59
  # Issued license key.
45
60
  key:,
61
+ # Current status of the license key. Activation fails unless it is `active`, so a
62
+ # client can warn before the customer tries.
63
+ status:,
46
64
  # Maximum activations allowed by the entitlement, when set.
47
65
  activations_limit: nil,
48
66
  # When the license key expires, when applicable.
@@ -53,8 +71,10 @@ module Dodopayments
53
71
  sig do
54
72
  override.returns(
55
73
  {
74
+ id: String,
56
75
  activations_used: Integer,
57
76
  key: String,
77
+ status: Dodopayments::LicenseKeyStatus::TaggedSymbol,
58
78
  activations_limit: T.nilable(Integer),
59
79
  expires_at: T.nilable(Time)
60
80
  }