dodopayments 2.24.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/models/brand.rb +9 -1
  5. data/lib/dodopayments/models/brand_archive_params.rb +35 -0
  6. data/lib/dodopayments/models/brand_archive_response.rb +57 -0
  7. data/lib/dodopayments/models/brand_list_params.rb +9 -1
  8. data/lib/dodopayments/models/checkout_session_flags.rb +13 -1
  9. data/lib/dodopayments/models/entitlements/license_key_grant.rb +24 -3
  10. data/lib/dodopayments/models/price.rb +34 -30
  11. data/lib/dodopayments/models/subscription_change_plan_response.rb +47 -0
  12. data/lib/dodopayments/models/subscription_update_params.rb +16 -4
  13. data/lib/dodopayments/models/update_subscription_plan_req.rb +35 -1
  14. data/lib/dodopayments/models.rb +2 -0
  15. data/lib/dodopayments/resources/brands.rb +35 -2
  16. data/lib/dodopayments/resources/subscriptions.rb +14 -6
  17. data/lib/dodopayments/version.rb +1 -1
  18. data/lib/dodopayments.rb +3 -0
  19. data/rbi/dodopayments/models/brand.rbi +8 -0
  20. data/rbi/dodopayments/models/brand_archive_params.rbi +58 -0
  21. data/rbi/dodopayments/models/brand_archive_response.rbi +80 -0
  22. data/rbi/dodopayments/models/brand_list_params.rbi +22 -5
  23. data/rbi/dodopayments/models/checkout_session_flags.rbi +22 -3
  24. data/rbi/dodopayments/models/entitlements/license_key_grant.rbi +22 -2
  25. data/rbi/dodopayments/models/price.rbi +47 -30
  26. data/rbi/dodopayments/models/subscription_change_plan_response.rbi +69 -0
  27. data/rbi/dodopayments/models/subscription_update_params.rbi +28 -4
  28. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +58 -0
  29. data/rbi/dodopayments/models.rbi +2 -0
  30. data/rbi/dodopayments/resources/brands.rbi +30 -4
  31. data/rbi/dodopayments/resources/subscriptions.rbi +63 -3
  32. data/sig/dodopayments/models/brand.rbs +5 -0
  33. data/sig/dodopayments/models/brand_archive_params.rbs +28 -0
  34. data/sig/dodopayments/models/brand_archive_response.rbs +45 -0
  35. data/sig/dodopayments/models/brand_list_params.rbs +14 -3
  36. data/sig/dodopayments/models/checkout_session_flags.rbs +10 -3
  37. data/sig/dodopayments/models/entitlements/license_key_grant.rbs +10 -0
  38. data/sig/dodopayments/models/price.rbs +21 -15
  39. data/sig/dodopayments/models/subscription_change_plan_response.rbs +35 -0
  40. data/sig/dodopayments/models/update_subscription_plan_req.rbs +14 -0
  41. data/sig/dodopayments/models.rbs +2 -0
  42. data/sig/dodopayments/resources/brands.rbs +7 -0
  43. data/sig/dodopayments/resources/subscriptions.rbs +5 -1
  44. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54faa371ee06087dd998ac36184e28534d52955c484830b985ef33041c1be2ef
4
- data.tar.gz: a3033cc80faf66427ae2dbbd42f326580702550236eeac8f672b12e85de156fd
3
+ metadata.gz: e8b7cafc248338a4ade0c7286d952538e01a9bf5d37c8055a00334dcadf4f704
4
+ data.tar.gz: f09302d55a6bb456e7be074623b1028461b3f2a06be0a473c20861ef5ee72009
5
5
  SHA512:
6
- metadata.gz: 51fcd5e514a4b8042240d297815f2857357d42344a60a9b157a6226f93dc5850d421fc560386ced09ec4b351fe0ea4daa685dc7d91dbc8a781bbd1471fcd75c8
7
- data.tar.gz: f55ccbebdd5c52348a75c2ff069352e5eef4b46e7898cd8401b166ffa7881ef4b387a71fa6f13902ece22d5f4dda4b20e39dfd05787ec2f4c912b7d58e8bb6ad
6
+ metadata.gz: e1eb4476c66201ce9fcc8f9c64604d33fa1f725f48f267683559a73657bf36f6a9572a8ae45290f3f0a92a2eb939e5fd30eecd7e6067d92d76196774cd24b3d5
7
+ data.tar.gz: 1a5f5a769335be408661bd207290c2c54f0cc8a93f8df439566d7cc49b2b643b2a84319f933ba7892fb0bf0f17733f7ec899c5ce0e42b3dffb289dc1c5d28475
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
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
+
11
+ ## [2.25.0](https://github.com/dodopayments/dodopayments-ruby/compare/v2.24.0...v2.25.0) (2026-08-17)
12
+
13
+
14
+ ### Features
15
+
16
+ * **api:** add brand archive endpoint ([ccc5fc9](https://github.com/dodopayments/dodopayments-ruby/commit/ccc5fc9c61410ac28010e98cc241ab8eb471cb72))
17
+ * **api:** add brand archive endpoint ([90fc52d](https://github.com/dodopayments/dodopayments-ruby/commit/90fc52df5e05849e2dfdd5b307ea2ff34edb050e))
18
+
3
19
  ## [2.24.0](https://github.com/dodopayments/dodopayments-ruby/compare/v2.23.0...v2.24.0) (2026-08-13)
4
20
 
5
21
 
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.24.0"
26
+ gem "dodopayments", "~> 2.26.0"
27
27
  ```
28
28
 
29
29
  <!-- x-release-please-end -->
@@ -34,6 +34,12 @@ module Dodopayments
34
34
  # @return [Symbol, Dodopayments::Models::Brand::VerificationStatus]
35
35
  required :verification_status, enum: -> { Dodopayments::Brand::VerificationStatus }
36
36
 
37
+ # @!attribute archived_at
38
+ # Time the brand was archived. Null for an active brand.
39
+ #
40
+ # @return [Time, nil]
41
+ optional :archived_at, Time, nil?: true
42
+
37
43
  # @!attribute description
38
44
  #
39
45
  # @return [String, nil]
@@ -65,7 +71,7 @@ module Dodopayments
65
71
  # @return [String, nil]
66
72
  optional :url, String, nil?: true
67
73
 
68
- # @!method initialize(brand_id:, business_id:, enabled:, statement_descriptor:, verification_enabled:, verification_status:, description: nil, image: nil, name: nil, reason_for_hold: nil, support_email: nil, url: nil)
74
+ # @!method initialize(brand_id:, business_id:, enabled:, statement_descriptor:, verification_enabled:, verification_status:, archived_at: nil, description: nil, image: nil, name: nil, reason_for_hold: nil, support_email: nil, url: nil)
69
75
  # @param brand_id [String]
70
76
  #
71
77
  # @param business_id [String]
@@ -78,6 +84,8 @@ module Dodopayments
78
84
  #
79
85
  # @param verification_status [Symbol, Dodopayments::Models::Brand::VerificationStatus]
80
86
  #
87
+ # @param archived_at [Time, nil] Time the brand was archived. Null for an active brand.
88
+ #
81
89
  # @param description [String, nil]
82
90
  #
83
91
  # @param image [String, nil]
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Brands#archive
6
+ class BrandArchiveParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ # @!attribute id
11
+ #
12
+ # @return [String]
13
+ required :id, String
14
+
15
+ # @!attribute move_products_to
16
+ # Brand that takes over the products and the live subscriptions of the brand you
17
+ # archive. It must be a brand of the same business, and it must not be archived.
18
+ # The primary brand (its brand id is the business id) is a valid target. Omit this
19
+ # field only when the brand holds no products and no live subscriptions.
20
+ #
21
+ # @return [String, nil]
22
+ optional :move_products_to, String, nil?: true
23
+
24
+ # @!method initialize(id:, move_products_to: nil, request_options: {})
25
+ # Some parameter documentations has been truncated, see
26
+ # {Dodopayments::Models::BrandArchiveParams} for more details.
27
+ #
28
+ # @param id [String]
29
+ #
30
+ # @param move_products_to [String, nil] Brand that takes over the products and the live subscriptions of the
31
+ #
32
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Brands#archive
6
+ class BrandArchiveResponse < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute archived_at
8
+ # Time the brand was archived.
9
+ #
10
+ # @return [Time]
11
+ required :archived_at, Time
12
+
13
+ # @!attribute brand_id
14
+ # The archived brand.
15
+ #
16
+ # @return [String]
17
+ required :brand_id, String
18
+
19
+ # @!attribute collections_moved
20
+ # Count of product collections moved to the target brand.
21
+ #
22
+ # @return [Integer]
23
+ required :collections_moved, Integer
24
+
25
+ # @!attribute products_moved
26
+ # Count of products moved to the target brand.
27
+ #
28
+ # @return [Integer]
29
+ required :products_moved, Integer
30
+
31
+ # @!attribute subscriptions_moved
32
+ # Count of live subscriptions moved to the target brand.
33
+ #
34
+ # @return [Integer]
35
+ required :subscriptions_moved, Integer
36
+
37
+ # @!attribute moved_to_brand_id
38
+ # Brand that received the moved records. Null when no target was given.
39
+ #
40
+ # @return [String, nil]
41
+ optional :moved_to_brand_id, String, nil?: true
42
+
43
+ # @!method initialize(archived_at:, brand_id:, collections_moved:, products_moved:, subscriptions_moved:, moved_to_brand_id: nil)
44
+ # @param archived_at [Time] Time the brand was archived.
45
+ #
46
+ # @param brand_id [String] The archived brand.
47
+ #
48
+ # @param collections_moved [Integer] Count of product collections moved to the target brand.
49
+ #
50
+ # @param products_moved [Integer] Count of products moved to the target brand.
51
+ #
52
+ # @param subscriptions_moved [Integer] Count of live subscriptions moved to the target brand.
53
+ #
54
+ # @param moved_to_brand_id [String, nil] Brand that received the moved records. Null when no target was given.
55
+ end
56
+ end
57
+ end
@@ -7,7 +7,15 @@ module Dodopayments
7
7
  extend Dodopayments::Internal::Type::RequestParameters::Converter
8
8
  include Dodopayments::Internal::Type::RequestParameters
9
9
 
10
- # @!method initialize(request_options: {})
10
+ # @!attribute include_archived
11
+ # Set to true to also list archived brands. Default false.
12
+ #
13
+ # @return [Boolean, nil]
14
+ optional :include_archived, Dodopayments::Internal::Type::Boolean
15
+
16
+ # @!method initialize(include_archived: nil, request_options: {})
17
+ # @param include_archived [Boolean] Set to true to also list archived brands. Default false.
18
+ #
11
19
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
12
20
  end
13
21
  end
@@ -122,7 +122,17 @@ module Dodopayments
122
122
  # @return [Boolean, nil]
123
123
  optional :require_phone_number, Dodopayments::Internal::Type::Boolean
124
124
 
125
- # @!method initialize(allow_currency_selection: nil, allow_customer_editing_business_name: nil, allow_customer_editing_city: nil, allow_customer_editing_country: nil, allow_customer_editing_email: nil, allow_customer_editing_name: nil, allow_customer_editing_state: nil, allow_customer_editing_street: nil, allow_customer_editing_tax_id: nil, allow_customer_editing_zipcode: nil, allow_discount_code: nil, allow_editing_addons: nil, allow_phone_number_collection: nil, allow_tax_id: nil, always_create_new_customer: nil, redirect_immediately: nil, require_phone_number: nil)
125
+ # @!attribute single_page
126
+ # If true, the session uses the single-page checkout flow: the page initializes
127
+ # the payment at load time and confirms it in place, with no separate payment
128
+ # page.
129
+ #
130
+ # Default is false
131
+ #
132
+ # @return [Boolean, nil]
133
+ optional :single_page, Dodopayments::Internal::Type::Boolean
134
+
135
+ # @!method initialize(allow_currency_selection: nil, allow_customer_editing_business_name: nil, allow_customer_editing_city: nil, allow_customer_editing_country: nil, allow_customer_editing_email: nil, allow_customer_editing_name: nil, allow_customer_editing_state: nil, allow_customer_editing_street: nil, allow_customer_editing_tax_id: nil, allow_customer_editing_zipcode: nil, allow_discount_code: nil, allow_editing_addons: nil, allow_phone_number_collection: nil, allow_tax_id: nil, always_create_new_customer: nil, redirect_immediately: nil, require_phone_number: nil, single_page: nil)
126
136
  # Some parameter documentations has been truncated, see
127
137
  # {Dodopayments::Models::CheckoutSessionFlags} for more details.
128
138
  #
@@ -159,6 +169,8 @@ module Dodopayments
159
169
  # @param redirect_immediately [Boolean] If true, redirects the customer immediately after payment completion
160
170
  #
161
171
  # @param require_phone_number [Boolean] If true, the customer must provide a phone number to complete checkout.
172
+ #
173
+ # @param single_page [Boolean] If true, the session uses the single-page checkout flow: the page
162
174
  end
163
175
  end
164
176
  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.
@@ -75,6 +75,8 @@ module Dodopayments
75
75
 
76
76
  Brand = Dodopayments::Models::Brand
77
77
 
78
+ BrandArchiveParams = Dodopayments::Models::BrandArchiveParams
79
+
78
80
  BrandCreateParams = Dodopayments::Models::BrandCreateParams
79
81
 
80
82
  BrandListParams = Dodopayments::Models::BrandListParams
@@ -78,7 +78,9 @@ module Dodopayments
78
78
  )
79
79
  end
80
80
 
81
- # @overload list(request_options: {})
81
+ # @overload list(include_archived: nil, request_options: {})
82
+ #
83
+ # @param include_archived [Boolean] Set to true to also list archived brands. Default false.
82
84
  #
83
85
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
84
86
  #
@@ -86,11 +88,42 @@ module Dodopayments
86
88
  #
87
89
  # @see Dodopayments::Models::BrandListParams
88
90
  def list(params = {})
91
+ parsed, options = Dodopayments::BrandListParams.dump_request(params)
92
+ query = Dodopayments::Internal::Util.encode_query_params(parsed)
89
93
  @client.request(
90
94
  method: :get,
91
95
  path: "brands",
96
+ query: query,
92
97
  model: Dodopayments::Models::BrandListResponse,
93
- options: params[:request_options]
98
+ options: options
99
+ )
100
+ end
101
+
102
+ # Some parameter documentations has been truncated, see
103
+ # {Dodopayments::Models::BrandArchiveParams} for more details.
104
+ #
105
+ # Archive a brand. Its products, live subscriptions, and product collections move
106
+ # to the `move_products_to` brand. Archive is permanent.
107
+ #
108
+ # @overload archive(id, move_products_to: nil, request_options: {})
109
+ #
110
+ # @param id [String] Brand Id
111
+ #
112
+ # @param move_products_to [String, nil] Brand that takes over the products and the live subscriptions of the
113
+ #
114
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
115
+ #
116
+ # @return [Dodopayments::Models::BrandArchiveResponse]
117
+ #
118
+ # @see Dodopayments::Models::BrandArchiveParams
119
+ def archive(id, params = {})
120
+ parsed, options = Dodopayments::BrandArchiveParams.dump_request(params)
121
+ @client.request(
122
+ method: :post,
123
+ path: ["brands/%1$s/archive", id],
124
+ body: parsed,
125
+ model: Dodopayments::Models::BrandArchiveResponse,
126
+ options: options
94
127
  )
95
128
  end
96
129