dodopayments 2.0.0 → 2.1.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +3 -3
- data/lib/dodopayments/models/discount.rb +10 -1
- data/lib/dodopayments/models/discount_create_params.rb +10 -1
- data/lib/dodopayments/models/discount_update_params.rb +10 -1
- data/lib/dodopayments/models/update_subscription_plan_req.rb +12 -1
- data/lib/dodopayments/resources/discounts.rb +6 -2
- data/lib/dodopayments/resources/subscriptions.rb +6 -2
- data/lib/dodopayments/version.rb +1 -1
- data/rbi/dodopayments/models/discount.rbi +10 -0
- data/rbi/dodopayments/models/discount_create_params.rbi +13 -0
- data/rbi/dodopayments/models/discount_update_params.rbi +10 -0
- data/rbi/dodopayments/models/update_subscription_plan_req.rbi +14 -0
- data/rbi/dodopayments/resources/discounts.rbi +8 -0
- data/rbi/dodopayments/resources/subscriptions.rbi +12 -0
- data/sig/dodopayments/models/discount.rbs +5 -0
- data/sig/dodopayments/models/discount_create_params.rbs +7 -0
- data/sig/dodopayments/models/discount_update_params.rbs +5 -0
- data/sig/dodopayments/models/update_subscription_plan_req.rbs +5 -0
- data/sig/dodopayments/resources/discounts.rbs +2 -0
- data/sig/dodopayments/resources/subscriptions.rbs +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0c8a1a7552dbf00a74ffe8f37ac2511e453f65ff038ec7aa37805abfe6d5c84c
|
|
4
|
+
data.tar.gz: 23c2069b2faaadec6ae986dc781bf173751d306cd26f3c065658ccc733a5a297
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74a022cc640152d922283897557440a4176700635040f3f3943fe61448b7134d21f80ad83247e50943dcfabe0fafcf83543159166de6bbb5dfcc814cd2dc4772
|
|
7
|
+
data.tar.gz: 4e82edb5899c4178ac6d2b50a2c2214ddde00849fa715ccf85d68b18a74d151673f8c7025db373e966cb549d0bf5e1376a74d4ec2afa7347f290942b3e5a294e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.0 (2026-03-05)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v2.0.0...v2.1.0](https://github.com/dodopayments/dodopayments-ruby/compare/v2.0.0...v2.1.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** updated openapi spec to v1.87.0 ([80979e6](https://github.com/dodopayments/dodopayments-ruby/commit/80979e652cba6b1ff1a3efaea1ff42b45ec26f41))
|
|
10
|
+
|
|
3
11
|
## 2.0.0 (2026-03-03)
|
|
4
12
|
|
|
5
13
|
Full Changelog: [v1.85.0...v2.0.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.85.0...v2.0.0)
|
data/README.md
CHANGED
|
@@ -8,8 +8,8 @@ It is generated with [Stainless](https://www.stainless.com/).
|
|
|
8
8
|
|
|
9
9
|
Use the Dodo Payments MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
|
|
10
10
|
|
|
11
|
-
[](https://cursor.com/en-US/install-mcp?name=dodopayments-mcp&config=
|
|
12
|
-
[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22dodopayments-mcp%22%2C%
|
|
11
|
+
[](https://cursor.com/en-US/install-mcp?name=dodopayments-mcp&config=eyJuYW1lIjoiZG9kb3BheW1lbnRzLW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL2RvZG8tcGF5bWVudHMuc3RsbWNwLmNvbSIsImhlYWRlcnMiOnsieC1kb2RvLXBheW1lbnRzLWFwaS1rZXkiOiJNeSBCZWFyZXIgVG9rZW4ifX0)
|
|
12
|
+
[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22dodopayments-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fdodo-payments.stlmcp.com%22%2C%22headers%22%3A%7B%22x-dodo-payments-api-key%22%3A%22My%20Bearer%20Token%22%7D%7D)
|
|
13
13
|
|
|
14
14
|
> Note: You may need to set environment variables in your MCP client.
|
|
15
15
|
|
|
@@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
26
26
|
<!-- x-release-please-start-version -->
|
|
27
27
|
|
|
28
28
|
```ruby
|
|
29
|
-
gem "dodopayments", "~> 2.
|
|
29
|
+
gem "dodopayments", "~> 2.1.0"
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
<!-- x-release-please-end -->
|
|
@@ -38,6 +38,13 @@ module Dodopayments
|
|
|
38
38
|
# @return [String]
|
|
39
39
|
required :discount_id, String
|
|
40
40
|
|
|
41
|
+
# @!attribute preserve_on_plan_change
|
|
42
|
+
# Whether this discount should be preserved when a subscription changes plans.
|
|
43
|
+
# Default: false (discount is removed on plan change)
|
|
44
|
+
#
|
|
45
|
+
# @return [Boolean]
|
|
46
|
+
required :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean
|
|
47
|
+
|
|
41
48
|
# @!attribute restricted_to
|
|
42
49
|
# List of product IDs to which this discount is restricted.
|
|
43
50
|
#
|
|
@@ -82,7 +89,7 @@ module Dodopayments
|
|
|
82
89
|
# @return [Integer, nil]
|
|
83
90
|
optional :usage_limit, Integer, nil?: true
|
|
84
91
|
|
|
85
|
-
# @!method initialize(amount:, business_id:, code:, created_at:, discount_id:, restricted_to:, times_used:, type:, expires_at: nil, name: nil, subscription_cycles: nil, usage_limit: nil)
|
|
92
|
+
# @!method initialize(amount:, business_id:, code:, created_at:, discount_id:, preserve_on_plan_change:, restricted_to:, times_used:, type:, expires_at: nil, name: nil, subscription_cycles: nil, usage_limit: nil)
|
|
86
93
|
# Some parameter documentations has been truncated, see
|
|
87
94
|
# {Dodopayments::Models::Discount} for more details.
|
|
88
95
|
#
|
|
@@ -96,6 +103,8 @@ module Dodopayments
|
|
|
96
103
|
#
|
|
97
104
|
# @param discount_id [String] The unique discount ID
|
|
98
105
|
#
|
|
106
|
+
# @param preserve_on_plan_change [Boolean] Whether this discount should be preserved when a subscription changes plans.
|
|
107
|
+
#
|
|
99
108
|
# @param restricted_to [Array<String>] List of product IDs to which this discount is restricted.
|
|
100
109
|
#
|
|
101
110
|
# @param times_used [Integer] How many times this discount has been used.
|
|
@@ -46,6 +46,13 @@ module Dodopayments
|
|
|
46
46
|
# @return [String, nil]
|
|
47
47
|
optional :name, String, nil?: true
|
|
48
48
|
|
|
49
|
+
# @!attribute preserve_on_plan_change
|
|
50
|
+
# Whether this discount should be preserved when a subscription changes plans.
|
|
51
|
+
# Default: false (discount is removed on plan change)
|
|
52
|
+
#
|
|
53
|
+
# @return [Boolean, nil]
|
|
54
|
+
optional :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean
|
|
55
|
+
|
|
49
56
|
# @!attribute restricted_to
|
|
50
57
|
# List of product IDs to restrict usage (if any).
|
|
51
58
|
#
|
|
@@ -66,7 +73,7 @@ module Dodopayments
|
|
|
66
73
|
# @return [Integer, nil]
|
|
67
74
|
optional :usage_limit, Integer, nil?: true
|
|
68
75
|
|
|
69
|
-
# @!method initialize(amount:, type:, code: nil, expires_at: nil, name: nil, restricted_to: nil, subscription_cycles: nil, usage_limit: nil, request_options: {})
|
|
76
|
+
# @!method initialize(amount:, type:, code: nil, expires_at: nil, name: nil, preserve_on_plan_change: nil, restricted_to: nil, subscription_cycles: nil, usage_limit: nil, request_options: {})
|
|
70
77
|
# Some parameter documentations has been truncated, see
|
|
71
78
|
# {Dodopayments::Models::DiscountCreateParams} for more details.
|
|
72
79
|
#
|
|
@@ -80,6 +87,8 @@ module Dodopayments
|
|
|
80
87
|
#
|
|
81
88
|
# @param name [String, nil]
|
|
82
89
|
#
|
|
90
|
+
# @param preserve_on_plan_change [Boolean] Whether this discount should be preserved when a subscription changes plans.
|
|
91
|
+
#
|
|
83
92
|
# @param restricted_to [Array<String>, nil] List of product IDs to restrict usage (if any).
|
|
84
93
|
#
|
|
85
94
|
# @param subscription_cycles [Integer, nil] Number of subscription billing cycles this discount is valid for.
|
|
@@ -35,6 +35,13 @@ module Dodopayments
|
|
|
35
35
|
# @return [String, nil]
|
|
36
36
|
optional :name, String, nil?: true
|
|
37
37
|
|
|
38
|
+
# @!attribute preserve_on_plan_change
|
|
39
|
+
# Whether this discount should be preserved when a subscription changes plans. If
|
|
40
|
+
# not provided, the existing value is kept.
|
|
41
|
+
#
|
|
42
|
+
# @return [Boolean, nil]
|
|
43
|
+
optional :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean, nil?: true
|
|
44
|
+
|
|
38
45
|
# @!attribute restricted_to
|
|
39
46
|
# If present, replaces all restricted product IDs with this new set. To remove all
|
|
40
47
|
# restrictions, send empty array
|
|
@@ -61,7 +68,7 @@ module Dodopayments
|
|
|
61
68
|
# @return [Integer, nil]
|
|
62
69
|
optional :usage_limit, Integer, nil?: true
|
|
63
70
|
|
|
64
|
-
# @!method initialize(amount: nil, code: nil, expires_at: nil, name: nil, restricted_to: nil, subscription_cycles: nil, type: nil, usage_limit: nil, request_options: {})
|
|
71
|
+
# @!method initialize(amount: nil, code: nil, expires_at: nil, name: nil, preserve_on_plan_change: nil, restricted_to: nil, subscription_cycles: nil, type: nil, usage_limit: nil, request_options: {})
|
|
65
72
|
# Some parameter documentations has been truncated, see
|
|
66
73
|
# {Dodopayments::Models::DiscountUpdateParams} for more details.
|
|
67
74
|
#
|
|
@@ -73,6 +80,8 @@ module Dodopayments
|
|
|
73
80
|
#
|
|
74
81
|
# @param name [String, nil]
|
|
75
82
|
#
|
|
83
|
+
# @param preserve_on_plan_change [Boolean, nil] Whether this discount should be preserved when a subscription changes plans.
|
|
84
|
+
#
|
|
76
85
|
# @param restricted_to [Array<String>, nil] If present, replaces all restricted product IDs with this new set.
|
|
77
86
|
#
|
|
78
87
|
# @param subscription_cycles [Integer, nil] Number of subscription billing cycles this discount is valid for.
|
|
@@ -29,6 +29,15 @@ module Dodopayments
|
|
|
29
29
|
# @return [Array<Dodopayments::Models::AttachAddon>, nil]
|
|
30
30
|
optional :addons, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::AttachAddon] }, nil?: true
|
|
31
31
|
|
|
32
|
+
# @!attribute discount_code
|
|
33
|
+
# Optional discount code to apply to the new plan. If provided, validates and
|
|
34
|
+
# applies the discount to the plan change. If not provided and the subscription
|
|
35
|
+
# has an existing discount with `preserve_on_plan_change=true`, the existing
|
|
36
|
+
# discount will be preserved (if applicable to the new product).
|
|
37
|
+
#
|
|
38
|
+
# @return [String, nil]
|
|
39
|
+
optional :discount_code, String, nil?: true
|
|
40
|
+
|
|
32
41
|
# @!attribute metadata
|
|
33
42
|
# Metadata for the payment. If not passed, the metadata of the subscription will
|
|
34
43
|
# be taken
|
|
@@ -50,7 +59,7 @@ module Dodopayments
|
|
|
50
59
|
enum: -> { Dodopayments::UpdateSubscriptionPlanReq::OnPaymentFailure },
|
|
51
60
|
nil?: true
|
|
52
61
|
|
|
53
|
-
# @!method initialize(product_id:, proration_billing_mode:, quantity:, addons: nil, metadata: nil, on_payment_failure: nil)
|
|
62
|
+
# @!method initialize(product_id:, proration_billing_mode:, quantity:, addons: nil, discount_code: nil, metadata: nil, on_payment_failure: nil)
|
|
54
63
|
# Some parameter documentations has been truncated, see
|
|
55
64
|
# {Dodopayments::Models::UpdateSubscriptionPlanReq} for more details.
|
|
56
65
|
#
|
|
@@ -62,6 +71,8 @@ module Dodopayments
|
|
|
62
71
|
#
|
|
63
72
|
# @param addons [Array<Dodopayments::Models::AttachAddon>, nil] Addons for the new plan.
|
|
64
73
|
#
|
|
74
|
+
# @param discount_code [String, nil] Optional discount code to apply to the new plan.
|
|
75
|
+
#
|
|
65
76
|
# @param metadata [Hash{Symbol=>String}, nil] Metadata for the payment. If not passed, the metadata of the subscription will b
|
|
66
77
|
#
|
|
67
78
|
# @param on_payment_failure [Symbol, Dodopayments::Models::UpdateSubscriptionPlanReq::OnPaymentFailure, nil] Controls behavior when the plan change payment fails.
|
|
@@ -9,7 +9,7 @@ module Dodopayments
|
|
|
9
9
|
# POST /discounts If `code` is omitted or empty, a random 16-char uppercase code
|
|
10
10
|
# is generated.
|
|
11
11
|
#
|
|
12
|
-
# @overload create(amount:, type:, code: nil, expires_at: nil, name: nil, restricted_to: nil, subscription_cycles: nil, usage_limit: nil, request_options: {})
|
|
12
|
+
# @overload create(amount:, type:, code: nil, expires_at: nil, name: nil, preserve_on_plan_change: nil, restricted_to: nil, subscription_cycles: nil, usage_limit: nil, request_options: {})
|
|
13
13
|
#
|
|
14
14
|
# @param amount [Integer] The discount amount.
|
|
15
15
|
#
|
|
@@ -21,6 +21,8 @@ module Dodopayments
|
|
|
21
21
|
#
|
|
22
22
|
# @param name [String, nil]
|
|
23
23
|
#
|
|
24
|
+
# @param preserve_on_plan_change [Boolean] Whether this discount should be preserved when a subscription changes plans.
|
|
25
|
+
#
|
|
24
26
|
# @param restricted_to [Array<String>, nil] List of product IDs to restrict usage (if any).
|
|
25
27
|
#
|
|
26
28
|
# @param subscription_cycles [Integer, nil] Number of subscription billing cycles this discount is valid for.
|
|
@@ -68,7 +70,7 @@ module Dodopayments
|
|
|
68
70
|
#
|
|
69
71
|
# PATCH /discounts/{discount_id}
|
|
70
72
|
#
|
|
71
|
-
# @overload update(discount_id, amount: nil, code: nil, expires_at: nil, name: nil, restricted_to: nil, subscription_cycles: nil, type: nil, usage_limit: nil, request_options: {})
|
|
73
|
+
# @overload update(discount_id, amount: nil, code: nil, expires_at: nil, name: nil, preserve_on_plan_change: nil, restricted_to: nil, subscription_cycles: nil, type: nil, usage_limit: nil, request_options: {})
|
|
72
74
|
#
|
|
73
75
|
# @param discount_id [String] Discount Id
|
|
74
76
|
#
|
|
@@ -80,6 +82,8 @@ module Dodopayments
|
|
|
80
82
|
#
|
|
81
83
|
# @param name [String, nil]
|
|
82
84
|
#
|
|
85
|
+
# @param preserve_on_plan_change [Boolean, nil] Whether this discount should be preserved when a subscription changes plans.
|
|
86
|
+
#
|
|
83
87
|
# @param restricted_to [Array<String>, nil] If present, replaces all restricted product IDs with this new set.
|
|
84
88
|
#
|
|
85
89
|
# @param subscription_cycles [Integer, nil] Number of subscription billing cycles this discount is valid for.
|
|
@@ -161,7 +161,7 @@ module Dodopayments
|
|
|
161
161
|
# Some parameter documentations has been truncated, see
|
|
162
162
|
# {Dodopayments::Models::SubscriptionChangePlanParams} for more details.
|
|
163
163
|
#
|
|
164
|
-
# @overload change_plan(subscription_id, product_id:, proration_billing_mode:, quantity:, addons: nil, metadata: nil, on_payment_failure: nil, request_options: {})
|
|
164
|
+
# @overload change_plan(subscription_id, product_id:, proration_billing_mode:, quantity:, addons: nil, discount_code: nil, metadata: nil, on_payment_failure: nil, request_options: {})
|
|
165
165
|
#
|
|
166
166
|
# @param subscription_id [String] Subscription Id
|
|
167
167
|
#
|
|
@@ -173,6 +173,8 @@ module Dodopayments
|
|
|
173
173
|
#
|
|
174
174
|
# @param addons [Array<Dodopayments::Models::AttachAddon>, nil] Addons for the new plan.
|
|
175
175
|
#
|
|
176
|
+
# @param discount_code [String, nil] Optional discount code to apply to the new plan.
|
|
177
|
+
#
|
|
176
178
|
# @param metadata [Hash{Symbol=>String}, nil] Metadata for the payment. If not passed, the metadata of the subscription will b
|
|
177
179
|
#
|
|
178
180
|
# @param on_payment_failure [Symbol, Dodopayments::Models::UpdateSubscriptionPlanReq::OnPaymentFailure, nil] Controls behavior when the plan change payment fails.
|
|
@@ -231,7 +233,7 @@ module Dodopayments
|
|
|
231
233
|
# Some parameter documentations has been truncated, see
|
|
232
234
|
# {Dodopayments::Models::SubscriptionPreviewChangePlanParams} for more details.
|
|
233
235
|
#
|
|
234
|
-
# @overload preview_change_plan(subscription_id, product_id:, proration_billing_mode:, quantity:, addons: nil, metadata: nil, on_payment_failure: nil, request_options: {})
|
|
236
|
+
# @overload preview_change_plan(subscription_id, product_id:, proration_billing_mode:, quantity:, addons: nil, discount_code: nil, metadata: nil, on_payment_failure: nil, request_options: {})
|
|
235
237
|
#
|
|
236
238
|
# @param subscription_id [String] Subscription Id
|
|
237
239
|
#
|
|
@@ -243,6 +245,8 @@ module Dodopayments
|
|
|
243
245
|
#
|
|
244
246
|
# @param addons [Array<Dodopayments::Models::AttachAddon>, nil] Addons for the new plan.
|
|
245
247
|
#
|
|
248
|
+
# @param discount_code [String, nil] Optional discount code to apply to the new plan.
|
|
249
|
+
#
|
|
246
250
|
# @param metadata [Hash{Symbol=>String}, nil] Metadata for the payment. If not passed, the metadata of the subscription will b
|
|
247
251
|
#
|
|
248
252
|
# @param on_payment_failure [Symbol, Dodopayments::Models::UpdateSubscriptionPlanReq::OnPaymentFailure, nil] Controls behavior when the plan change payment fails.
|
data/lib/dodopayments/version.rb
CHANGED
|
@@ -32,6 +32,11 @@ module Dodopayments
|
|
|
32
32
|
sig { returns(String) }
|
|
33
33
|
attr_accessor :discount_id
|
|
34
34
|
|
|
35
|
+
# Whether this discount should be preserved when a subscription changes plans.
|
|
36
|
+
# Default: false (discount is removed on plan change)
|
|
37
|
+
sig { returns(T::Boolean) }
|
|
38
|
+
attr_accessor :preserve_on_plan_change
|
|
39
|
+
|
|
35
40
|
# List of product IDs to which this discount is restricted.
|
|
36
41
|
sig { returns(T::Array[String]) }
|
|
37
42
|
attr_accessor :restricted_to
|
|
@@ -69,6 +74,7 @@ module Dodopayments
|
|
|
69
74
|
code: String,
|
|
70
75
|
created_at: Time,
|
|
71
76
|
discount_id: String,
|
|
77
|
+
preserve_on_plan_change: T::Boolean,
|
|
72
78
|
restricted_to: T::Array[String],
|
|
73
79
|
times_used: Integer,
|
|
74
80
|
type: Dodopayments::DiscountType::OrSymbol,
|
|
@@ -93,6 +99,9 @@ module Dodopayments
|
|
|
93
99
|
created_at:,
|
|
94
100
|
# The unique discount ID
|
|
95
101
|
discount_id:,
|
|
102
|
+
# Whether this discount should be preserved when a subscription changes plans.
|
|
103
|
+
# Default: false (discount is removed on plan change)
|
|
104
|
+
preserve_on_plan_change:,
|
|
96
105
|
# List of product IDs to which this discount is restricted.
|
|
97
106
|
restricted_to:,
|
|
98
107
|
# How many times this discount has been used.
|
|
@@ -120,6 +129,7 @@ module Dodopayments
|
|
|
120
129
|
code: String,
|
|
121
130
|
created_at: Time,
|
|
122
131
|
discount_id: String,
|
|
132
|
+
preserve_on_plan_change: T::Boolean,
|
|
123
133
|
restricted_to: T::Array[String],
|
|
124
134
|
times_used: Integer,
|
|
125
135
|
type: Dodopayments::DiscountType::TaggedSymbol,
|
|
@@ -43,6 +43,14 @@ module Dodopayments
|
|
|
43
43
|
sig { returns(T.nilable(String)) }
|
|
44
44
|
attr_accessor :name
|
|
45
45
|
|
|
46
|
+
# Whether this discount should be preserved when a subscription changes plans.
|
|
47
|
+
# Default: false (discount is removed on plan change)
|
|
48
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
49
|
+
attr_reader :preserve_on_plan_change
|
|
50
|
+
|
|
51
|
+
sig { params(preserve_on_plan_change: T::Boolean).void }
|
|
52
|
+
attr_writer :preserve_on_plan_change
|
|
53
|
+
|
|
46
54
|
# List of product IDs to restrict usage (if any).
|
|
47
55
|
sig { returns(T.nilable(T::Array[String])) }
|
|
48
56
|
attr_accessor :restricted_to
|
|
@@ -64,6 +72,7 @@ module Dodopayments
|
|
|
64
72
|
code: T.nilable(String),
|
|
65
73
|
expires_at: T.nilable(Time),
|
|
66
74
|
name: T.nilable(String),
|
|
75
|
+
preserve_on_plan_change: T::Boolean,
|
|
67
76
|
restricted_to: T.nilable(T::Array[String]),
|
|
68
77
|
subscription_cycles: T.nilable(Integer),
|
|
69
78
|
usage_limit: T.nilable(Integer),
|
|
@@ -90,6 +99,9 @@ module Dodopayments
|
|
|
90
99
|
# When the discount expires, if ever.
|
|
91
100
|
expires_at: nil,
|
|
92
101
|
name: nil,
|
|
102
|
+
# Whether this discount should be preserved when a subscription changes plans.
|
|
103
|
+
# Default: false (discount is removed on plan change)
|
|
104
|
+
preserve_on_plan_change: nil,
|
|
93
105
|
# List of product IDs to restrict usage (if any).
|
|
94
106
|
restricted_to: nil,
|
|
95
107
|
# Number of subscription billing cycles this discount is valid for. If not
|
|
@@ -110,6 +122,7 @@ module Dodopayments
|
|
|
110
122
|
code: T.nilable(String),
|
|
111
123
|
expires_at: T.nilable(Time),
|
|
112
124
|
name: T.nilable(String),
|
|
125
|
+
preserve_on_plan_change: T::Boolean,
|
|
113
126
|
restricted_to: T.nilable(T::Array[String]),
|
|
114
127
|
subscription_cycles: T.nilable(Integer),
|
|
115
128
|
usage_limit: T.nilable(Integer),
|
|
@@ -34,6 +34,11 @@ module Dodopayments
|
|
|
34
34
|
sig { returns(T.nilable(String)) }
|
|
35
35
|
attr_accessor :name
|
|
36
36
|
|
|
37
|
+
# Whether this discount should be preserved when a subscription changes plans. If
|
|
38
|
+
# not provided, the existing value is kept.
|
|
39
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
40
|
+
attr_accessor :preserve_on_plan_change
|
|
41
|
+
|
|
37
42
|
# If present, replaces all restricted product IDs with this new set. To remove all
|
|
38
43
|
# restrictions, send empty array
|
|
39
44
|
sig { returns(T.nilable(T::Array[String])) }
|
|
@@ -58,6 +63,7 @@ module Dodopayments
|
|
|
58
63
|
code: T.nilable(String),
|
|
59
64
|
expires_at: T.nilable(Time),
|
|
60
65
|
name: T.nilable(String),
|
|
66
|
+
preserve_on_plan_change: T.nilable(T::Boolean),
|
|
61
67
|
restricted_to: T.nilable(T::Array[String]),
|
|
62
68
|
subscription_cycles: T.nilable(Integer),
|
|
63
69
|
type: T.nilable(Dodopayments::DiscountType::OrSymbol),
|
|
@@ -78,6 +84,9 @@ module Dodopayments
|
|
|
78
84
|
code: nil,
|
|
79
85
|
expires_at: nil,
|
|
80
86
|
name: nil,
|
|
87
|
+
# Whether this discount should be preserved when a subscription changes plans. If
|
|
88
|
+
# not provided, the existing value is kept.
|
|
89
|
+
preserve_on_plan_change: nil,
|
|
81
90
|
# If present, replaces all restricted product IDs with this new set. To remove all
|
|
82
91
|
# restrictions, send empty array
|
|
83
92
|
restricted_to: nil,
|
|
@@ -99,6 +108,7 @@ module Dodopayments
|
|
|
99
108
|
code: T.nilable(String),
|
|
100
109
|
expires_at: T.nilable(Time),
|
|
101
110
|
name: T.nilable(String),
|
|
111
|
+
preserve_on_plan_change: T.nilable(T::Boolean),
|
|
102
112
|
restricted_to: T.nilable(T::Array[String]),
|
|
103
113
|
subscription_cycles: T.nilable(Integer),
|
|
104
114
|
type: T.nilable(Dodopayments::DiscountType::OrSymbol),
|
|
@@ -32,6 +32,13 @@ module Dodopayments
|
|
|
32
32
|
sig { returns(T.nilable(T::Array[Dodopayments::AttachAddon])) }
|
|
33
33
|
attr_accessor :addons
|
|
34
34
|
|
|
35
|
+
# Optional discount code to apply to the new plan. If provided, validates and
|
|
36
|
+
# applies the discount to the plan change. If not provided and the subscription
|
|
37
|
+
# has an existing discount with `preserve_on_plan_change=true`, the existing
|
|
38
|
+
# discount will be preserved (if applicable to the new product).
|
|
39
|
+
sig { returns(T.nilable(String)) }
|
|
40
|
+
attr_accessor :discount_code
|
|
41
|
+
|
|
35
42
|
# Metadata for the payment. If not passed, the metadata of the subscription will
|
|
36
43
|
# be taken
|
|
37
44
|
sig { returns(T.nilable(T::Hash[Symbol, String])) }
|
|
@@ -60,6 +67,7 @@ module Dodopayments
|
|
|
60
67
|
Dodopayments::UpdateSubscriptionPlanReq::ProrationBillingMode::OrSymbol,
|
|
61
68
|
quantity: Integer,
|
|
62
69
|
addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
|
|
70
|
+
discount_code: T.nilable(String),
|
|
63
71
|
metadata: T.nilable(T::Hash[Symbol, String]),
|
|
64
72
|
on_payment_failure:
|
|
65
73
|
T.nilable(
|
|
@@ -77,6 +85,11 @@ module Dodopayments
|
|
|
77
85
|
# Addons for the new plan. Note : Leaving this empty would remove any existing
|
|
78
86
|
# addons
|
|
79
87
|
addons: nil,
|
|
88
|
+
# Optional discount code to apply to the new plan. If provided, validates and
|
|
89
|
+
# applies the discount to the plan change. If not provided and the subscription
|
|
90
|
+
# has an existing discount with `preserve_on_plan_change=true`, the existing
|
|
91
|
+
# discount will be preserved (if applicable to the new product).
|
|
92
|
+
discount_code: nil,
|
|
80
93
|
# Metadata for the payment. If not passed, the metadata of the subscription will
|
|
81
94
|
# be taken
|
|
82
95
|
metadata: nil,
|
|
@@ -99,6 +112,7 @@ module Dodopayments
|
|
|
99
112
|
Dodopayments::UpdateSubscriptionPlanReq::ProrationBillingMode::OrSymbol,
|
|
100
113
|
quantity: Integer,
|
|
101
114
|
addons: T.nilable(T::Array[Dodopayments::AttachAddon]),
|
|
115
|
+
discount_code: T.nilable(String),
|
|
102
116
|
metadata: T.nilable(T::Hash[Symbol, String]),
|
|
103
117
|
on_payment_failure:
|
|
104
118
|
T.nilable(
|
|
@@ -12,6 +12,7 @@ module Dodopayments
|
|
|
12
12
|
code: T.nilable(String),
|
|
13
13
|
expires_at: T.nilable(Time),
|
|
14
14
|
name: T.nilable(String),
|
|
15
|
+
preserve_on_plan_change: T::Boolean,
|
|
15
16
|
restricted_to: T.nilable(T::Array[String]),
|
|
16
17
|
subscription_cycles: T.nilable(Integer),
|
|
17
18
|
usage_limit: T.nilable(Integer),
|
|
@@ -38,6 +39,9 @@ module Dodopayments
|
|
|
38
39
|
# When the discount expires, if ever.
|
|
39
40
|
expires_at: nil,
|
|
40
41
|
name: nil,
|
|
42
|
+
# Whether this discount should be preserved when a subscription changes plans.
|
|
43
|
+
# Default: false (discount is removed on plan change)
|
|
44
|
+
preserve_on_plan_change: nil,
|
|
41
45
|
# List of product IDs to restrict usage (if any).
|
|
42
46
|
restricted_to: nil,
|
|
43
47
|
# Number of subscription billing cycles this discount is valid for. If not
|
|
@@ -72,6 +76,7 @@ module Dodopayments
|
|
|
72
76
|
code: T.nilable(String),
|
|
73
77
|
expires_at: T.nilable(Time),
|
|
74
78
|
name: T.nilable(String),
|
|
79
|
+
preserve_on_plan_change: T.nilable(T::Boolean),
|
|
75
80
|
restricted_to: T.nilable(T::Array[String]),
|
|
76
81
|
subscription_cycles: T.nilable(Integer),
|
|
77
82
|
type: T.nilable(Dodopayments::DiscountType::OrSymbol),
|
|
@@ -94,6 +99,9 @@ module Dodopayments
|
|
|
94
99
|
code: nil,
|
|
95
100
|
expires_at: nil,
|
|
96
101
|
name: nil,
|
|
102
|
+
# Whether this discount should be preserved when a subscription changes plans. If
|
|
103
|
+
# not provided, the existing value is kept.
|
|
104
|
+
preserve_on_plan_change: nil,
|
|
97
105
|
# If present, replaces all restricted product IDs with this new set. To remove all
|
|
98
106
|
# restrictions, send empty array
|
|
99
107
|
restricted_to: nil,
|
|
@@ -194,6 +194,7 @@ module Dodopayments
|
|
|
194
194
|
Dodopayments::UpdateSubscriptionPlanReq::ProrationBillingMode::OrSymbol,
|
|
195
195
|
quantity: Integer,
|
|
196
196
|
addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
|
|
197
|
+
discount_code: T.nilable(String),
|
|
197
198
|
metadata: T.nilable(T::Hash[Symbol, String]),
|
|
198
199
|
on_payment_failure:
|
|
199
200
|
T.nilable(
|
|
@@ -214,6 +215,11 @@ module Dodopayments
|
|
|
214
215
|
# Addons for the new plan. Note : Leaving this empty would remove any existing
|
|
215
216
|
# addons
|
|
216
217
|
addons: nil,
|
|
218
|
+
# Optional discount code to apply to the new plan. If provided, validates and
|
|
219
|
+
# applies the discount to the plan change. If not provided and the subscription
|
|
220
|
+
# has an existing discount with `preserve_on_plan_change=true`, the existing
|
|
221
|
+
# discount will be preserved (if applicable to the new product).
|
|
222
|
+
discount_code: nil,
|
|
217
223
|
# Metadata for the payment. If not passed, the metadata of the subscription will
|
|
218
224
|
# be taken
|
|
219
225
|
metadata: nil,
|
|
@@ -277,6 +283,7 @@ module Dodopayments
|
|
|
277
283
|
Dodopayments::UpdateSubscriptionPlanReq::ProrationBillingMode::OrSymbol,
|
|
278
284
|
quantity: Integer,
|
|
279
285
|
addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
|
|
286
|
+
discount_code: T.nilable(String),
|
|
280
287
|
metadata: T.nilable(T::Hash[Symbol, String]),
|
|
281
288
|
on_payment_failure:
|
|
282
289
|
T.nilable(
|
|
@@ -297,6 +304,11 @@ module Dodopayments
|
|
|
297
304
|
# Addons for the new plan. Note : Leaving this empty would remove any existing
|
|
298
305
|
# addons
|
|
299
306
|
addons: nil,
|
|
307
|
+
# Optional discount code to apply to the new plan. If provided, validates and
|
|
308
|
+
# applies the discount to the plan change. If not provided and the subscription
|
|
309
|
+
# has an existing discount with `preserve_on_plan_change=true`, the existing
|
|
310
|
+
# discount will be preserved (if applicable to the new product).
|
|
311
|
+
discount_code: nil,
|
|
300
312
|
# Metadata for the payment. If not passed, the metadata of the subscription will
|
|
301
313
|
# be taken
|
|
302
314
|
metadata: nil,
|
|
@@ -7,6 +7,7 @@ module Dodopayments
|
|
|
7
7
|
code: String,
|
|
8
8
|
created_at: Time,
|
|
9
9
|
discount_id: String,
|
|
10
|
+
preserve_on_plan_change: bool,
|
|
10
11
|
restricted_to: ::Array[String],
|
|
11
12
|
times_used: Integer,
|
|
12
13
|
type: Dodopayments::Models::discount_type,
|
|
@@ -27,6 +28,8 @@ module Dodopayments
|
|
|
27
28
|
|
|
28
29
|
attr_accessor discount_id: String
|
|
29
30
|
|
|
31
|
+
attr_accessor preserve_on_plan_change: bool
|
|
32
|
+
|
|
30
33
|
attr_accessor restricted_to: ::Array[String]
|
|
31
34
|
|
|
32
35
|
attr_accessor times_used: Integer
|
|
@@ -47,6 +50,7 @@ module Dodopayments
|
|
|
47
50
|
code: String,
|
|
48
51
|
created_at: Time,
|
|
49
52
|
discount_id: String,
|
|
53
|
+
preserve_on_plan_change: bool,
|
|
50
54
|
restricted_to: ::Array[String],
|
|
51
55
|
times_used: Integer,
|
|
52
56
|
type: Dodopayments::Models::discount_type,
|
|
@@ -62,6 +66,7 @@ module Dodopayments
|
|
|
62
66
|
code: String,
|
|
63
67
|
created_at: Time,
|
|
64
68
|
discount_id: String,
|
|
69
|
+
preserve_on_plan_change: bool,
|
|
65
70
|
restricted_to: ::Array[String],
|
|
66
71
|
times_used: Integer,
|
|
67
72
|
type: Dodopayments::Models::discount_type,
|
|
@@ -7,6 +7,7 @@ module Dodopayments
|
|
|
7
7
|
code: String?,
|
|
8
8
|
expires_at: Time?,
|
|
9
9
|
name: String?,
|
|
10
|
+
preserve_on_plan_change: bool,
|
|
10
11
|
restricted_to: ::Array[String]?,
|
|
11
12
|
subscription_cycles: Integer?,
|
|
12
13
|
usage_limit: Integer?
|
|
@@ -27,6 +28,10 @@ module Dodopayments
|
|
|
27
28
|
|
|
28
29
|
attr_accessor name: String?
|
|
29
30
|
|
|
31
|
+
attr_reader preserve_on_plan_change: bool?
|
|
32
|
+
|
|
33
|
+
def preserve_on_plan_change=: (bool) -> bool
|
|
34
|
+
|
|
30
35
|
attr_accessor restricted_to: ::Array[String]?
|
|
31
36
|
|
|
32
37
|
attr_accessor subscription_cycles: Integer?
|
|
@@ -39,6 +44,7 @@ module Dodopayments
|
|
|
39
44
|
?code: String?,
|
|
40
45
|
?expires_at: Time?,
|
|
41
46
|
?name: String?,
|
|
47
|
+
?preserve_on_plan_change: bool,
|
|
42
48
|
?restricted_to: ::Array[String]?,
|
|
43
49
|
?subscription_cycles: Integer?,
|
|
44
50
|
?usage_limit: Integer?,
|
|
@@ -51,6 +57,7 @@ module Dodopayments
|
|
|
51
57
|
code: String?,
|
|
52
58
|
expires_at: Time?,
|
|
53
59
|
name: String?,
|
|
60
|
+
preserve_on_plan_change: bool,
|
|
54
61
|
restricted_to: ::Array[String]?,
|
|
55
62
|
subscription_cycles: Integer?,
|
|
56
63
|
usage_limit: Integer?,
|
|
@@ -6,6 +6,7 @@ module Dodopayments
|
|
|
6
6
|
code: String?,
|
|
7
7
|
expires_at: Time?,
|
|
8
8
|
name: String?,
|
|
9
|
+
preserve_on_plan_change: bool?,
|
|
9
10
|
restricted_to: ::Array[String]?,
|
|
10
11
|
subscription_cycles: Integer?,
|
|
11
12
|
type: Dodopayments::Models::discount_type?,
|
|
@@ -25,6 +26,8 @@ module Dodopayments
|
|
|
25
26
|
|
|
26
27
|
attr_accessor name: String?
|
|
27
28
|
|
|
29
|
+
attr_accessor preserve_on_plan_change: bool?
|
|
30
|
+
|
|
28
31
|
attr_accessor restricted_to: ::Array[String]?
|
|
29
32
|
|
|
30
33
|
attr_accessor subscription_cycles: Integer?
|
|
@@ -38,6 +41,7 @@ module Dodopayments
|
|
|
38
41
|
?code: String?,
|
|
39
42
|
?expires_at: Time?,
|
|
40
43
|
?name: String?,
|
|
44
|
+
?preserve_on_plan_change: bool?,
|
|
41
45
|
?restricted_to: ::Array[String]?,
|
|
42
46
|
?subscription_cycles: Integer?,
|
|
43
47
|
?type: Dodopayments::Models::discount_type?,
|
|
@@ -50,6 +54,7 @@ module Dodopayments
|
|
|
50
54
|
code: String?,
|
|
51
55
|
expires_at: Time?,
|
|
52
56
|
name: String?,
|
|
57
|
+
preserve_on_plan_change: bool?,
|
|
53
58
|
restricted_to: ::Array[String]?,
|
|
54
59
|
subscription_cycles: Integer?,
|
|
55
60
|
type: Dodopayments::Models::discount_type?,
|
|
@@ -6,6 +6,7 @@ module Dodopayments
|
|
|
6
6
|
proration_billing_mode: Dodopayments::Models::UpdateSubscriptionPlanReq::proration_billing_mode,
|
|
7
7
|
quantity: Integer,
|
|
8
8
|
addons: ::Array[Dodopayments::AttachAddon]?,
|
|
9
|
+
discount_code: String?,
|
|
9
10
|
metadata: ::Hash[Symbol, String]?,
|
|
10
11
|
on_payment_failure: Dodopayments::Models::UpdateSubscriptionPlanReq::on_payment_failure?
|
|
11
12
|
}
|
|
@@ -19,6 +20,8 @@ module Dodopayments
|
|
|
19
20
|
|
|
20
21
|
attr_accessor addons: ::Array[Dodopayments::AttachAddon]?
|
|
21
22
|
|
|
23
|
+
attr_accessor discount_code: String?
|
|
24
|
+
|
|
22
25
|
attr_accessor metadata: ::Hash[Symbol, String]?
|
|
23
26
|
|
|
24
27
|
attr_accessor on_payment_failure: Dodopayments::Models::UpdateSubscriptionPlanReq::on_payment_failure?
|
|
@@ -28,6 +31,7 @@ module Dodopayments
|
|
|
28
31
|
proration_billing_mode: Dodopayments::Models::UpdateSubscriptionPlanReq::proration_billing_mode,
|
|
29
32
|
quantity: Integer,
|
|
30
33
|
?addons: ::Array[Dodopayments::AttachAddon]?,
|
|
34
|
+
?discount_code: String?,
|
|
31
35
|
?metadata: ::Hash[Symbol, String]?,
|
|
32
36
|
?on_payment_failure: Dodopayments::Models::UpdateSubscriptionPlanReq::on_payment_failure?
|
|
33
37
|
) -> void
|
|
@@ -37,6 +41,7 @@ module Dodopayments
|
|
|
37
41
|
proration_billing_mode: Dodopayments::Models::UpdateSubscriptionPlanReq::proration_billing_mode,
|
|
38
42
|
quantity: Integer,
|
|
39
43
|
addons: ::Array[Dodopayments::AttachAddon]?,
|
|
44
|
+
discount_code: String?,
|
|
40
45
|
metadata: ::Hash[Symbol, String]?,
|
|
41
46
|
on_payment_failure: Dodopayments::Models::UpdateSubscriptionPlanReq::on_payment_failure?
|
|
42
47
|
}
|
|
@@ -7,6 +7,7 @@ module Dodopayments
|
|
|
7
7
|
?code: String?,
|
|
8
8
|
?expires_at: Time?,
|
|
9
9
|
?name: String?,
|
|
10
|
+
?preserve_on_plan_change: bool,
|
|
10
11
|
?restricted_to: ::Array[String]?,
|
|
11
12
|
?subscription_cycles: Integer?,
|
|
12
13
|
?usage_limit: Integer?,
|
|
@@ -24,6 +25,7 @@ module Dodopayments
|
|
|
24
25
|
?code: String?,
|
|
25
26
|
?expires_at: Time?,
|
|
26
27
|
?name: String?,
|
|
28
|
+
?preserve_on_plan_change: bool?,
|
|
27
29
|
?restricted_to: ::Array[String]?,
|
|
28
30
|
?subscription_cycles: Integer?,
|
|
29
31
|
?type: Dodopayments::Models::discount_type?,
|
|
@@ -62,6 +62,7 @@ module Dodopayments
|
|
|
62
62
|
proration_billing_mode: Dodopayments::Models::UpdateSubscriptionPlanReq::proration_billing_mode,
|
|
63
63
|
quantity: Integer,
|
|
64
64
|
?addons: ::Array[Dodopayments::AttachAddon]?,
|
|
65
|
+
?discount_code: String?,
|
|
65
66
|
?metadata: ::Hash[Symbol, String]?,
|
|
66
67
|
?on_payment_failure: Dodopayments::Models::UpdateSubscriptionPlanReq::on_payment_failure?,
|
|
67
68
|
?request_options: Dodopayments::request_opts
|
|
@@ -84,6 +85,7 @@ module Dodopayments
|
|
|
84
85
|
proration_billing_mode: Dodopayments::Models::UpdateSubscriptionPlanReq::proration_billing_mode,
|
|
85
86
|
quantity: Integer,
|
|
86
87
|
?addons: ::Array[Dodopayments::AttachAddon]?,
|
|
88
|
+
?discount_code: String?,
|
|
87
89
|
?metadata: ::Hash[Symbol, String]?,
|
|
88
90
|
?on_payment_failure: Dodopayments::Models::UpdateSubscriptionPlanReq::on_payment_failure?,
|
|
89
91
|
?request_options: Dodopayments::request_opts
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dodopayments
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dodo Payments
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cgi
|