dodopayments 2.8.1 → 2.9.1

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 (195) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/models/attach_product_entitlement.rb +22 -0
  6. data/lib/dodopayments/models/cancellation_feedback.rb +21 -0
  7. data/lib/dodopayments/models/checkout_session_flags.rb +12 -1
  8. data/lib/dodopayments/models/checkout_session_request.rb +14 -1
  9. data/lib/dodopayments/models/credit_entitlements/credit_ledger_entry.rb +1 -0
  10. data/lib/dodopayments/models/credit_overage_reset_webhook_event.rb +52 -0
  11. data/lib/dodopayments/models/customer_list_entitlements_params.rb +20 -0
  12. data/lib/dodopayments/models/customer_list_entitlements_response.rb +105 -0
  13. data/lib/dodopayments/models/digital_product_delivery.rb +19 -14
  14. data/lib/dodopayments/models/digital_product_delivery_file.rb +40 -9
  15. data/lib/dodopayments/models/entitlement.rb +97 -0
  16. data/lib/dodopayments/models/entitlement_create_params.rb +54 -0
  17. data/lib/dodopayments/models/entitlement_delete_params.rb +20 -0
  18. data/lib/dodopayments/models/entitlement_grant_created_webhook_event.rb +56 -0
  19. data/lib/dodopayments/models/entitlement_grant_delivered_webhook_event.rb +56 -0
  20. data/lib/dodopayments/models/entitlement_grant_failed_webhook_event.rb +56 -0
  21. data/lib/dodopayments/models/entitlement_grant_revoked_webhook_event.rb +56 -0
  22. data/lib/dodopayments/models/entitlement_integration_type.rb +21 -0
  23. data/lib/dodopayments/models/entitlement_list_params.rb +55 -0
  24. data/lib/dodopayments/models/entitlement_retrieve_params.rb +20 -0
  25. data/lib/dodopayments/models/entitlement_update_params.rb +54 -0
  26. data/lib/dodopayments/models/entitlements/entitlement_grant.rb +190 -0
  27. data/lib/dodopayments/models/entitlements/file_delete_params.rb +28 -0
  28. data/lib/dodopayments/models/entitlements/file_upload_params.rb +22 -0
  29. data/lib/dodopayments/models/entitlements/file_upload_response.rb +23 -0
  30. data/lib/dodopayments/models/entitlements/grant_list_params.rb +68 -0
  31. data/lib/dodopayments/models/entitlements/grant_revoke_params.rb +28 -0
  32. data/lib/dodopayments/models/entitlements/license_key_grant.rb +45 -0
  33. data/lib/dodopayments/models/integration_config.rb +217 -0
  34. data/lib/dodopayments/models/integration_config_response.rb +278 -0
  35. data/lib/dodopayments/models/license_key_instance_list_params.rb +9 -1
  36. data/lib/dodopayments/models/one_time_product_cart_item.rb +15 -1
  37. data/lib/dodopayments/models/payment.rb +19 -3
  38. data/lib/dodopayments/models/payment_create_params.rb +23 -35
  39. data/lib/dodopayments/models/payment_create_response.rb +3 -33
  40. data/lib/dodopayments/models/product.rb +10 -217
  41. data/lib/dodopayments/models/product_create_params.rb +25 -6
  42. data/lib/dodopayments/models/product_entitlement_summary.rb +57 -0
  43. data/lib/dodopayments/models/product_list_response.rb +3 -218
  44. data/lib/dodopayments/models/product_update_params.rb +21 -7
  45. data/lib/dodopayments/models/scheduled_plan_change.rb +99 -0
  46. data/lib/dodopayments/models/subscription.rb +20 -102
  47. data/lib/dodopayments/models/subscription_create_params.rb +27 -37
  48. data/lib/dodopayments/models/subscription_create_response.rb +19 -3
  49. data/lib/dodopayments/models/subscription_list_response.rb +3 -103
  50. data/lib/dodopayments/models/subscription_update_params.rb +23 -1
  51. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +11 -1
  52. data/lib/dodopayments/models/unwrap_webhook_event.rb +11 -1
  53. data/lib/dodopayments/models/update_subscription_plan_req.rb +10 -1
  54. data/lib/dodopayments/models/webhook_event_type.rb +1 -0
  55. data/lib/dodopayments/models/webhook_payload.rb +6 -153
  56. data/lib/dodopayments/models.rb +40 -0
  57. data/lib/dodopayments/resources/checkout_sessions.rb +6 -2
  58. data/lib/dodopayments/resources/customers.rb +20 -0
  59. data/lib/dodopayments/resources/entitlements/files.rb +63 -0
  60. data/lib/dodopayments/resources/entitlements/grants.rb +76 -0
  61. data/lib/dodopayments/resources/entitlements.rb +153 -0
  62. data/lib/dodopayments/resources/license_key_instances.rb +3 -1
  63. data/lib/dodopayments/resources/payments.rb +6 -2
  64. data/lib/dodopayments/resources/products.rb +4 -4
  65. data/lib/dodopayments/resources/subscriptions.rb +20 -5
  66. data/lib/dodopayments/resources/webhooks.rb +2 -2
  67. data/lib/dodopayments/version.rb +1 -1
  68. data/lib/dodopayments.rb +30 -0
  69. data/rbi/dodopayments/client.rbi +3 -0
  70. data/rbi/dodopayments/models/attach_product_entitlement.rbi +35 -0
  71. data/rbi/dodopayments/models/cancellation_feedback.rbi +45 -0
  72. data/rbi/dodopayments/models/checkout_session_flags.rbi +20 -3
  73. data/rbi/dodopayments/models/checkout_session_request.rbi +18 -0
  74. data/rbi/dodopayments/models/credit_entitlements/credit_ledger_entry.rbi +5 -0
  75. data/rbi/dodopayments/models/credit_overage_reset_webhook_event.rbi +103 -0
  76. data/rbi/dodopayments/models/customer_list_entitlements_params.rbi +38 -0
  77. data/rbi/dodopayments/models/customer_list_entitlements_response.rbi +189 -0
  78. data/rbi/dodopayments/models/digital_product_delivery.rbi +16 -18
  79. data/rbi/dodopayments/models/digital_product_delivery_file.rbi +51 -8
  80. data/rbi/dodopayments/models/entitlement.rbi +127 -0
  81. data/rbi/dodopayments/models/entitlement_create_params.rbi +115 -0
  82. data/rbi/dodopayments/models/entitlement_delete_params.rbi +38 -0
  83. data/rbi/dodopayments/models/entitlement_grant_created_webhook_event.rbi +107 -0
  84. data/rbi/dodopayments/models/entitlement_grant_delivered_webhook_event.rbi +107 -0
  85. data/rbi/dodopayments/models/entitlement_grant_failed_webhook_event.rbi +106 -0
  86. data/rbi/dodopayments/models/entitlement_grant_revoked_webhook_event.rbi +107 -0
  87. data/rbi/dodopayments/models/entitlement_integration_type.rbi +44 -0
  88. data/rbi/dodopayments/models/entitlement_list_params.rbi +146 -0
  89. data/rbi/dodopayments/models/entitlement_retrieve_params.rbi +38 -0
  90. data/rbi/dodopayments/models/entitlement_update_params.rbi +111 -0
  91. data/rbi/dodopayments/models/entitlements/entitlement_grant.rbi +269 -0
  92. data/rbi/dodopayments/models/entitlements/file_delete_params.rbi +48 -0
  93. data/rbi/dodopayments/models/entitlements/file_upload_params.rbi +40 -0
  94. data/rbi/dodopayments/models/entitlements/file_upload_response.rbi +34 -0
  95. data/rbi/dodopayments/models/entitlements/grant_list_params.rbi +145 -0
  96. data/rbi/dodopayments/models/entitlements/grant_revoke_params.rbi +48 -0
  97. data/rbi/dodopayments/models/entitlements/license_key_grant.rbi +68 -0
  98. data/rbi/dodopayments/models/integration_config.rbi +411 -0
  99. data/rbi/dodopayments/models/integration_config_response.rbi +531 -0
  100. data/rbi/dodopayments/models/license_key_instance_list_params.rbi +8 -0
  101. data/rbi/dodopayments/models/one_time_product_cart_item.rbi +24 -3
  102. data/rbi/dodopayments/models/payment.rbi +31 -3
  103. data/rbi/dodopayments/models/payment_create_params.rbi +28 -56
  104. data/rbi/dodopayments/models/payment_create_response.rbi +3 -68
  105. data/rbi/dodopayments/models/product.rbi +8 -420
  106. data/rbi/dodopayments/models/product_create_params.rbi +43 -7
  107. data/rbi/dodopayments/models/product_entitlement_summary.rbi +88 -0
  108. data/rbi/dodopayments/models/product_list_response.rbi +3 -430
  109. data/rbi/dodopayments/models/product_update_params.rbi +35 -9
  110. data/rbi/dodopayments/models/scheduled_plan_change.rbi +141 -0
  111. data/rbi/dodopayments/models/subscription.rbi +24 -149
  112. data/rbi/dodopayments/models/subscription_create_params.rbi +36 -68
  113. data/rbi/dodopayments/models/subscription_create_response.rbi +47 -3
  114. data/rbi/dodopayments/models/subscription_list_response.rbi +4 -167
  115. data/rbi/dodopayments/models/subscription_update_params.rbi +27 -0
  116. data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +5 -0
  117. data/rbi/dodopayments/models/unwrap_webhook_event.rbi +5 -0
  118. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +10 -0
  119. data/rbi/dodopayments/models/webhook_event_type.rbi +5 -0
  120. data/rbi/dodopayments/models/webhook_payload.rbi +6 -197
  121. data/rbi/dodopayments/models.rbi +46 -0
  122. data/rbi/dodopayments/resources/checkout_sessions.rbi +16 -0
  123. data/rbi/dodopayments/resources/customers.rbi +14 -0
  124. data/rbi/dodopayments/resources/entitlements/files.rbi +45 -0
  125. data/rbi/dodopayments/resources/entitlements/grants.rbi +63 -0
  126. data/rbi/dodopayments/resources/entitlements.rbi +143 -0
  127. data/rbi/dodopayments/resources/license_key_instances.rbi +3 -0
  128. data/rbi/dodopayments/resources/payments.rbi +10 -2
  129. data/rbi/dodopayments/resources/products.rbi +34 -7
  130. data/rbi/dodopayments/resources/subscriptions.rbi +31 -5
  131. data/rbi/dodopayments/resources/webhooks.rbi +10 -0
  132. data/sig/dodopayments/client.rbs +2 -0
  133. data/sig/dodopayments/models/attach_product_entitlement.rbs +13 -0
  134. data/sig/dodopayments/models/cancellation_feedback.rbs +28 -0
  135. data/sig/dodopayments/models/checkout_session_flags.rbs +10 -3
  136. data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
  137. data/sig/dodopayments/models/credit_entitlements/credit_ledger_entry.rbs +2 -0
  138. data/sig/dodopayments/models/credit_overage_reset_webhook_event.rbs +45 -0
  139. data/sig/dodopayments/models/customer_list_entitlements_params.rbs +23 -0
  140. data/sig/dodopayments/models/customer_list_entitlements_response.rbs +95 -0
  141. data/sig/dodopayments/models/digital_product_delivery.rbs +5 -5
  142. data/sig/dodopayments/models/digital_product_delivery_file.rbs +32 -5
  143. data/sig/dodopayments/models/entitlement.rbs +65 -0
  144. data/sig/dodopayments/models/entitlement_create_params.rbs +48 -0
  145. data/sig/dodopayments/models/entitlement_delete_params.rbs +23 -0
  146. data/sig/dodopayments/models/entitlement_grant_created_webhook_event.rbs +45 -0
  147. data/sig/dodopayments/models/entitlement_grant_delivered_webhook_event.rbs +45 -0
  148. data/sig/dodopayments/models/entitlement_grant_failed_webhook_event.rbs +45 -0
  149. data/sig/dodopayments/models/entitlement_grant_revoked_webhook_event.rbs +45 -0
  150. data/sig/dodopayments/models/entitlement_integration_type.rbs +28 -0
  151. data/sig/dodopayments/models/entitlement_list_params.rbs +69 -0
  152. data/sig/dodopayments/models/entitlement_retrieve_params.rbs +23 -0
  153. data/sig/dodopayments/models/entitlement_update_params.rbs +46 -0
  154. data/sig/dodopayments/models/entitlements/entitlement_grant.rbs +127 -0
  155. data/sig/dodopayments/models/entitlements/file_delete_params.rbs +30 -0
  156. data/sig/dodopayments/models/entitlements/file_upload_params.rbs +25 -0
  157. data/sig/dodopayments/models/entitlements/file_upload_response.rbs +15 -0
  158. data/sig/dodopayments/models/entitlements/grant_list_params.rbs +71 -0
  159. data/sig/dodopayments/models/entitlements/grant_revoke_params.rbs +30 -0
  160. data/sig/dodopayments/models/entitlements/license_key_grant.rbs +37 -0
  161. data/sig/dodopayments/models/integration_config.rbs +171 -0
  162. data/sig/dodopayments/models/integration_config_response.rbs +225 -0
  163. data/sig/dodopayments/models/license_key_instance_list_params.rbs +10 -1
  164. data/sig/dodopayments/models/one_time_product_cart_item.rbs +14 -3
  165. data/sig/dodopayments/models/payment.rbs +16 -4
  166. data/sig/dodopayments/models/payment_create_params.rbs +16 -27
  167. data/sig/dodopayments/models/payment_create_response.rbs +4 -27
  168. data/sig/dodopayments/models/product.rbs +4 -205
  169. data/sig/dodopayments/models/product_create_params.rbs +4 -4
  170. data/sig/dodopayments/models/product_entitlement_summary.rbs +40 -0
  171. data/sig/dodopayments/models/product_list_response.rbs +4 -205
  172. data/sig/dodopayments/models/product_update_params.rbs +4 -4
  173. data/sig/dodopayments/models/scheduled_plan_change.rbs +73 -0
  174. data/sig/dodopayments/models/subscription.rbs +14 -74
  175. data/sig/dodopayments/models/subscription_create_params.rbs +16 -27
  176. data/sig/dodopayments/models/subscription_create_response.rbs +16 -4
  177. data/sig/dodopayments/models/subscription_list_response.rbs +4 -74
  178. data/sig/dodopayments/models/subscription_update_params.rbs +12 -0
  179. data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +5 -0
  180. data/sig/dodopayments/models/unwrap_webhook_event.rbs +5 -0
  181. data/sig/dodopayments/models/update_subscription_plan_req.rbs +5 -0
  182. data/sig/dodopayments/models/webhook_event_type.rbs +2 -0
  183. data/sig/dodopayments/models/webhook_payload.rbs +8 -134
  184. data/sig/dodopayments/models.rbs +40 -0
  185. data/sig/dodopayments/resources/checkout_sessions.rbs +2 -0
  186. data/sig/dodopayments/resources/customers.rbs +5 -0
  187. data/sig/dodopayments/resources/entitlements/files.rbs +20 -0
  188. data/sig/dodopayments/resources/entitlements/grants.rbs +24 -0
  189. data/sig/dodopayments/resources/entitlements.rbs +46 -0
  190. data/sig/dodopayments/resources/license_key_instances.rbs +1 -0
  191. data/sig/dodopayments/resources/payments.rbs +3 -1
  192. data/sig/dodopayments/resources/products.rbs +2 -2
  193. data/sig/dodopayments/resources/subscriptions.rbs +7 -1
  194. data/sig/dodopayments/resources/webhooks.rbs +10 -0
  195. metadata +92 -2
@@ -36,6 +36,8 @@ module Dodopayments
36
36
  attr_accessor :description
37
37
 
38
38
  # Choose how you would like you digital product delivered
39
+ #
40
+ # deprecated: use entitlements instead
39
41
  sig do
40
42
  returns(
41
43
  T.nilable(Dodopayments::ProductUpdateParams::DigitalProductDelivery)
@@ -53,10 +55,12 @@ module Dodopayments
53
55
  end
54
56
  attr_writer :digital_product_delivery
55
57
 
56
- # Entitlement IDs to attach (replaces all existing when present) Send empty array
57
- # to remove all, omit field to leave unchanged
58
- sig { returns(T.nilable(T::Array[String])) }
59
- attr_accessor :entitlement_ids
58
+ # Entitlements to attach (replaces all existing when present) Send empty array to
59
+ # remove all, omit field to leave unchanged
60
+ sig do
61
+ returns(T.nilable(T::Array[Dodopayments::AttachProductEntitlement]))
62
+ end
63
+ attr_accessor :entitlements
60
64
 
61
65
  # Product image id after its uploaded to S3
62
66
  sig { returns(T.nilable(String)) }
@@ -66,6 +70,8 @@ module Dodopayments
66
70
  #
67
71
  # Only applicable if `license_key_enabled` is `true`. This message contains
68
72
  # instructions for activating the license key.
73
+ #
74
+ # deprecated: use entitlements instead
69
75
  sig { returns(T.nilable(String)) }
70
76
  attr_accessor :license_key_activation_message
71
77
 
@@ -73,6 +79,8 @@ module Dodopayments
73
79
  #
74
80
  # Only applicable if `license_key_enabled` is `true`. Represents the maximum
75
81
  # number of times the license key can be activated.
82
+ #
83
+ # deprecated: use entitlements instead
76
84
  sig { returns(T.nilable(Integer)) }
77
85
  attr_accessor :license_key_activations_limit
78
86
 
@@ -80,6 +88,8 @@ module Dodopayments
80
88
  #
81
89
  # Only applicable if `license_key_enabled` is `true`. Represents the duration in
82
90
  # days for which the license key is valid.
91
+ #
92
+ # deprecated: use entitlements instead
83
93
  sig { returns(T.nilable(Dodopayments::LicenseKeyDuration)) }
84
94
  attr_reader :license_key_duration
85
95
 
@@ -95,6 +105,8 @@ module Dodopayments
95
105
  #
96
106
  # If `true`, additional fields related to license key (duration, activations
97
107
  # limit, activation message) become applicable.
108
+ #
109
+ # deprecated: use entitlements instead
98
110
  sig { returns(T.nilable(T::Boolean)) }
99
111
  attr_accessor :license_key_enabled
100
112
 
@@ -136,7 +148,8 @@ module Dodopayments
136
148
  T.nilable(
137
149
  Dodopayments::ProductUpdateParams::DigitalProductDelivery::OrHash
138
150
  ),
139
- entitlement_ids: T.nilable(T::Array[String]),
151
+ entitlements:
152
+ T.nilable(T::Array[Dodopayments::AttachProductEntitlement::OrHash]),
140
153
  image_id: T.nilable(String),
141
154
  license_key_activation_message: T.nilable(String),
142
155
  license_key_activations_limit: T.nilable(Integer),
@@ -168,31 +181,41 @@ module Dodopayments
168
181
  # Description of the product, optional and must be at most 1000 characters.
169
182
  description: nil,
170
183
  # Choose how you would like you digital product delivered
184
+ #
185
+ # deprecated: use entitlements instead
171
186
  digital_product_delivery: nil,
172
- # Entitlement IDs to attach (replaces all existing when present) Send empty array
173
- # to remove all, omit field to leave unchanged
174
- entitlement_ids: nil,
187
+ # Entitlements to attach (replaces all existing when present) Send empty array to
188
+ # remove all, omit field to leave unchanged
189
+ entitlements: nil,
175
190
  # Product image id after its uploaded to S3
176
191
  image_id: nil,
177
192
  # Message sent to the customer upon license key activation.
178
193
  #
179
194
  # Only applicable if `license_key_enabled` is `true`. This message contains
180
195
  # instructions for activating the license key.
196
+ #
197
+ # deprecated: use entitlements instead
181
198
  license_key_activation_message: nil,
182
199
  # Limit for the number of activations for the license key.
183
200
  #
184
201
  # Only applicable if `license_key_enabled` is `true`. Represents the maximum
185
202
  # number of times the license key can be activated.
203
+ #
204
+ # deprecated: use entitlements instead
186
205
  license_key_activations_limit: nil,
187
206
  # Duration of the license key if enabled.
188
207
  #
189
208
  # Only applicable if `license_key_enabled` is `true`. Represents the duration in
190
209
  # days for which the license key is valid.
210
+ #
211
+ # deprecated: use entitlements instead
191
212
  license_key_duration: nil,
192
213
  # Whether the product requires a license key.
193
214
  #
194
215
  # If `true`, additional fields related to license key (duration, activations
195
216
  # limit, activation message) become applicable.
217
+ #
218
+ # deprecated: use entitlements instead
196
219
  license_key_enabled: nil,
197
220
  # Additional metadata for the product
198
221
  metadata: nil,
@@ -219,7 +242,8 @@ module Dodopayments
219
242
  T.nilable(
220
243
  Dodopayments::ProductUpdateParams::DigitalProductDelivery
221
244
  ),
222
- entitlement_ids: T.nilable(T::Array[String]),
245
+ entitlements:
246
+ T.nilable(T::Array[Dodopayments::AttachProductEntitlement]),
223
247
  image_id: T.nilable(String),
224
248
  license_key_activation_message: T.nilable(String),
225
249
  license_key_activations_limit: T.nilable(Integer),
@@ -265,6 +289,8 @@ module Dodopayments
265
289
  attr_accessor :instructions
266
290
 
267
291
  # Choose how you would like you digital product delivered
292
+ #
293
+ # deprecated: use entitlements instead
268
294
  sig do
269
295
  params(
270
296
  external_url: T.nilable(String),
@@ -0,0 +1,141 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class ScheduledPlanChange < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::ScheduledPlanChange,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The scheduled plan change ID
15
+ sig { returns(String) }
16
+ attr_accessor :id
17
+
18
+ # Addons included in the scheduled change
19
+ sig { returns(T::Array[Dodopayments::ScheduledPlanChange::Addon]) }
20
+ attr_accessor :addons
21
+
22
+ # When this scheduled change was created
23
+ sig { returns(Time) }
24
+ attr_accessor :created_at
25
+
26
+ # When the change will be applied
27
+ sig { returns(Time) }
28
+ attr_accessor :effective_at
29
+
30
+ # The product ID the subscription will change to
31
+ sig { returns(String) }
32
+ attr_accessor :product_id
33
+
34
+ # Quantity for the new plan
35
+ sig { returns(Integer) }
36
+ attr_accessor :quantity
37
+
38
+ # Description of the product being changed to
39
+ sig { returns(T.nilable(String)) }
40
+ attr_accessor :product_description
41
+
42
+ # Name of the product being changed to
43
+ sig { returns(T.nilable(String)) }
44
+ attr_accessor :product_name
45
+
46
+ sig do
47
+ params(
48
+ id: String,
49
+ addons: T::Array[Dodopayments::ScheduledPlanChange::Addon::OrHash],
50
+ created_at: Time,
51
+ effective_at: Time,
52
+ product_id: String,
53
+ quantity: Integer,
54
+ product_description: T.nilable(String),
55
+ product_name: T.nilable(String)
56
+ ).returns(T.attached_class)
57
+ end
58
+ def self.new(
59
+ # The scheduled plan change ID
60
+ id:,
61
+ # Addons included in the scheduled change
62
+ addons:,
63
+ # When this scheduled change was created
64
+ created_at:,
65
+ # When the change will be applied
66
+ effective_at:,
67
+ # The product ID the subscription will change to
68
+ product_id:,
69
+ # Quantity for the new plan
70
+ quantity:,
71
+ # Description of the product being changed to
72
+ product_description: nil,
73
+ # Name of the product being changed to
74
+ product_name: nil
75
+ )
76
+ end
77
+
78
+ sig do
79
+ override.returns(
80
+ {
81
+ id: String,
82
+ addons: T::Array[Dodopayments::ScheduledPlanChange::Addon],
83
+ created_at: Time,
84
+ effective_at: Time,
85
+ product_id: String,
86
+ quantity: Integer,
87
+ product_description: T.nilable(String),
88
+ product_name: T.nilable(String)
89
+ }
90
+ )
91
+ end
92
+ def to_hash
93
+ end
94
+
95
+ class Addon < Dodopayments::Internal::Type::BaseModel
96
+ OrHash =
97
+ T.type_alias do
98
+ T.any(
99
+ Dodopayments::ScheduledPlanChange::Addon,
100
+ Dodopayments::Internal::AnyHash
101
+ )
102
+ end
103
+
104
+ # The addon ID
105
+ sig { returns(String) }
106
+ attr_accessor :addon_id
107
+
108
+ # Name of the addon
109
+ sig { returns(String) }
110
+ attr_accessor :name
111
+
112
+ # Quantity of the addon
113
+ sig { returns(Integer) }
114
+ attr_accessor :quantity
115
+
116
+ sig do
117
+ params(addon_id: String, name: String, quantity: Integer).returns(
118
+ T.attached_class
119
+ )
120
+ end
121
+ def self.new(
122
+ # The addon ID
123
+ addon_id:,
124
+ # Name of the addon
125
+ name:,
126
+ # Quantity of the addon
127
+ quantity:
128
+ )
129
+ end
130
+
131
+ sig do
132
+ override.returns(
133
+ { addon_id: String, name: String, quantity: Integer }
134
+ )
135
+ end
136
+ def to_hash
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
@@ -116,6 +116,16 @@ module Dodopayments
116
116
  sig { returns(Integer) }
117
117
  attr_accessor :trial_period_days
118
118
 
119
+ # Free-text cancellation comment, if any
120
+ sig { returns(T.nilable(String)) }
121
+ attr_accessor :cancellation_comment
122
+
123
+ # Customer-supplied churn reason, if any
124
+ sig do
125
+ returns(T.nilable(Dodopayments::CancellationFeedback::TaggedSymbol))
126
+ end
127
+ attr_accessor :cancellation_feedback
128
+
119
129
  # Cancelled timestamp if the subscription is cancelled
120
130
  sig { returns(T.nilable(Time)) }
121
131
  attr_accessor :cancelled_at
@@ -141,13 +151,12 @@ module Dodopayments
141
151
  attr_accessor :payment_method_id
142
152
 
143
153
  # Scheduled plan change details, if any
144
- sig { returns(T.nilable(Dodopayments::Subscription::ScheduledChange)) }
154
+ sig { returns(T.nilable(Dodopayments::ScheduledPlanChange)) }
145
155
  attr_reader :scheduled_change
146
156
 
147
157
  sig do
148
158
  params(
149
- scheduled_change:
150
- T.nilable(Dodopayments::Subscription::ScheduledChange::OrHash)
159
+ scheduled_change: T.nilable(Dodopayments::ScheduledPlanChange::OrHash)
151
160
  ).void
152
161
  end
153
162
  attr_writer :scheduled_change
@@ -185,6 +194,9 @@ module Dodopayments
185
194
  subscription_period_interval: Dodopayments::TimeInterval::OrSymbol,
186
195
  tax_inclusive: T::Boolean,
187
196
  trial_period_days: Integer,
197
+ cancellation_comment: T.nilable(String),
198
+ cancellation_feedback:
199
+ T.nilable(Dodopayments::CancellationFeedback::OrSymbol),
188
200
  cancelled_at: T.nilable(Time),
189
201
  custom_field_responses:
190
202
  T.nilable(T::Array[Dodopayments::CustomFieldResponse::OrHash]),
@@ -193,7 +205,7 @@ module Dodopayments
193
205
  expires_at: T.nilable(Time),
194
206
  payment_method_id: T.nilable(String),
195
207
  scheduled_change:
196
- T.nilable(Dodopayments::Subscription::ScheduledChange::OrHash),
208
+ T.nilable(Dodopayments::ScheduledPlanChange::OrHash),
197
209
  tax_id: T.nilable(String)
198
210
  ).returns(T.attached_class)
199
211
  end
@@ -248,6 +260,10 @@ module Dodopayments
248
260
  tax_inclusive:,
249
261
  # Number of days in the trial period (0 if no trial)
250
262
  trial_period_days:,
263
+ # Free-text cancellation comment, if any
264
+ cancellation_comment: nil,
265
+ # Customer-supplied churn reason, if any
266
+ cancellation_feedback: nil,
251
267
  # Cancelled timestamp if the subscription is cancelled
252
268
  cancelled_at: nil,
253
269
  # Customer's responses to custom fields collected during checkout
@@ -298,6 +314,9 @@ module Dodopayments
298
314
  Dodopayments::TimeInterval::TaggedSymbol,
299
315
  tax_inclusive: T::Boolean,
300
316
  trial_period_days: Integer,
317
+ cancellation_comment: T.nilable(String),
318
+ cancellation_feedback:
319
+ T.nilable(Dodopayments::CancellationFeedback::TaggedSymbol),
301
320
  cancelled_at: T.nilable(Time),
302
321
  custom_field_responses:
303
322
  T.nilable(T::Array[Dodopayments::CustomFieldResponse]),
@@ -305,157 +324,13 @@ module Dodopayments
305
324
  discount_id: T.nilable(String),
306
325
  expires_at: T.nilable(Time),
307
326
  payment_method_id: T.nilable(String),
308
- scheduled_change:
309
- T.nilable(Dodopayments::Subscription::ScheduledChange),
327
+ scheduled_change: T.nilable(Dodopayments::ScheduledPlanChange),
310
328
  tax_id: T.nilable(String)
311
329
  }
312
330
  )
313
331
  end
314
332
  def to_hash
315
333
  end
316
-
317
- class ScheduledChange < Dodopayments::Internal::Type::BaseModel
318
- OrHash =
319
- T.type_alias do
320
- T.any(
321
- Dodopayments::Subscription::ScheduledChange,
322
- Dodopayments::Internal::AnyHash
323
- )
324
- end
325
-
326
- # The scheduled plan change ID
327
- sig { returns(String) }
328
- attr_accessor :id
329
-
330
- # Addons included in the scheduled change
331
- sig do
332
- returns(T::Array[Dodopayments::Subscription::ScheduledChange::Addon])
333
- end
334
- attr_accessor :addons
335
-
336
- # When this scheduled change was created
337
- sig { returns(Time) }
338
- attr_accessor :created_at
339
-
340
- # When the change will be applied
341
- sig { returns(Time) }
342
- attr_accessor :effective_at
343
-
344
- # The product ID the subscription will change to
345
- sig { returns(String) }
346
- attr_accessor :product_id
347
-
348
- # Quantity for the new plan
349
- sig { returns(Integer) }
350
- attr_accessor :quantity
351
-
352
- # Description of the product being changed to
353
- sig { returns(T.nilable(String)) }
354
- attr_accessor :product_description
355
-
356
- # Name of the product being changed to
357
- sig { returns(T.nilable(String)) }
358
- attr_accessor :product_name
359
-
360
- # Scheduled plan change details, if any
361
- sig do
362
- params(
363
- id: String,
364
- addons:
365
- T::Array[
366
- Dodopayments::Subscription::ScheduledChange::Addon::OrHash
367
- ],
368
- created_at: Time,
369
- effective_at: Time,
370
- product_id: String,
371
- quantity: Integer,
372
- product_description: T.nilable(String),
373
- product_name: T.nilable(String)
374
- ).returns(T.attached_class)
375
- end
376
- def self.new(
377
- # The scheduled plan change ID
378
- id:,
379
- # Addons included in the scheduled change
380
- addons:,
381
- # When this scheduled change was created
382
- created_at:,
383
- # When the change will be applied
384
- effective_at:,
385
- # The product ID the subscription will change to
386
- product_id:,
387
- # Quantity for the new plan
388
- quantity:,
389
- # Description of the product being changed to
390
- product_description: nil,
391
- # Name of the product being changed to
392
- product_name: nil
393
- )
394
- end
395
-
396
- sig do
397
- override.returns(
398
- {
399
- id: String,
400
- addons:
401
- T::Array[Dodopayments::Subscription::ScheduledChange::Addon],
402
- created_at: Time,
403
- effective_at: Time,
404
- product_id: String,
405
- quantity: Integer,
406
- product_description: T.nilable(String),
407
- product_name: T.nilable(String)
408
- }
409
- )
410
- end
411
- def to_hash
412
- end
413
-
414
- class Addon < Dodopayments::Internal::Type::BaseModel
415
- OrHash =
416
- T.type_alias do
417
- T.any(
418
- Dodopayments::Subscription::ScheduledChange::Addon,
419
- Dodopayments::Internal::AnyHash
420
- )
421
- end
422
-
423
- # The addon ID
424
- sig { returns(String) }
425
- attr_accessor :addon_id
426
-
427
- # Name of the addon
428
- sig { returns(String) }
429
- attr_accessor :name
430
-
431
- # Quantity of the addon
432
- sig { returns(Integer) }
433
- attr_accessor :quantity
434
-
435
- sig do
436
- params(addon_id: String, name: String, quantity: Integer).returns(
437
- T.attached_class
438
- )
439
- end
440
- def self.new(
441
- # The addon ID
442
- addon_id:,
443
- # Name of the addon
444
- name:,
445
- # Quantity of the addon
446
- quantity:
447
- )
448
- end
449
-
450
- sig do
451
- override.returns(
452
- { addon_id: String, name: String, quantity: Integer }
453
- )
454
- end
455
- def to_hash
456
- end
457
- end
458
- end
459
334
  end
460
335
  end
461
336
  end
@@ -65,6 +65,15 @@ module Dodopayments
65
65
  sig { returns(T.nilable(T::Boolean)) }
66
66
  attr_accessor :force_3ds
67
67
 
68
+ # Override the merchant-level mandate floor (in INR paise) for INR e-mandates on
69
+ # Indian-card recurring payments. The mandate amount sent to the processor is
70
+ # `max(this_floor, actual_billing_amount)`, so this is effectively the
71
+ # customer-facing authorization ceiling whenever billing is lower. When unset, the
72
+ # merchant setting applies; when that's also unset, the system default of ₹15,000
73
+ # applies.
74
+ sig { returns(T.nilable(Integer)) }
75
+ attr_accessor :mandate_min_amount_inr_paise
76
+
68
77
  # Additional metadata for the subscription Defaults to empty if not specified
69
78
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
70
79
  attr_reader :metadata
@@ -84,13 +93,7 @@ module Dodopayments
84
93
 
85
94
  # List of one time products that will be bundled with the first payment for this
86
95
  # subscription
87
- sig do
88
- returns(
89
- T.nilable(
90
- T::Array[Dodopayments::SubscriptionCreateParams::OneTimeProductCart]
91
- )
92
- )
93
- end
96
+ sig { returns(T.nilable(T::Array[Dodopayments::OneTimeProductCartItem])) }
94
97
  attr_accessor :one_time_product_cart
95
98
 
96
99
  # If true, generates a payment link. Defaults to false if not specified.
@@ -111,6 +114,15 @@ module Dodopayments
111
114
  sig { params(redirect_immediately: T::Boolean).void }
112
115
  attr_writer :redirect_immediately
113
116
 
117
+ # If true, the customer's phone number is required to create this subscription.
118
+ # Typically set alongside `payment_link=true` so merchants can enforce phone
119
+ # collection on the hosted payment page. Defaults to false.
120
+ sig { returns(T.nilable(T::Boolean)) }
121
+ attr_reader :require_phone_number
122
+
123
+ sig { params(require_phone_number: T::Boolean).void }
124
+ attr_writer :require_phone_number
125
+
114
126
  # Optional URL to redirect after successful subscription creation
115
127
  sig { returns(T.nilable(String)) }
116
128
  attr_accessor :return_url
@@ -152,17 +164,15 @@ module Dodopayments
152
164
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
153
165
  discount_code: T.nilable(String),
154
166
  force_3ds: T.nilable(T::Boolean),
167
+ mandate_min_amount_inr_paise: T.nilable(Integer),
155
168
  metadata: T::Hash[Symbol, String],
156
169
  on_demand: T.nilable(Dodopayments::OnDemandSubscription::OrHash),
157
170
  one_time_product_cart:
158
- T.nilable(
159
- T::Array[
160
- Dodopayments::SubscriptionCreateParams::OneTimeProductCart::OrHash
161
- ]
162
- ),
171
+ T.nilable(T::Array[Dodopayments::OneTimeProductCartItem::OrHash]),
163
172
  payment_link: T.nilable(T::Boolean),
164
173
  payment_method_id: T.nilable(String),
165
174
  redirect_immediately: T::Boolean,
175
+ require_phone_number: T::Boolean,
166
176
  return_url: T.nilable(String),
167
177
  short_link: T.nilable(T::Boolean),
168
178
  show_saved_payment_methods: T::Boolean,
@@ -196,6 +206,13 @@ module Dodopayments
196
206
  discount_code: nil,
197
207
  # Override merchant default 3DS behaviour for this subscription
198
208
  force_3ds: nil,
209
+ # Override the merchant-level mandate floor (in INR paise) for INR e-mandates on
210
+ # Indian-card recurring payments. The mandate amount sent to the processor is
211
+ # `max(this_floor, actual_billing_amount)`, so this is effectively the
212
+ # customer-facing authorization ceiling whenever billing is lower. When unset, the
213
+ # merchant setting applies; when that's also unset, the system default of ₹15,000
214
+ # applies.
215
+ mandate_min_amount_inr_paise: nil,
199
216
  # Additional metadata for the subscription Defaults to empty if not specified
200
217
  metadata: nil,
201
218
  on_demand: nil,
@@ -211,6 +228,10 @@ module Dodopayments
211
228
  # If true, redirects the customer immediately after payment completion False by
212
229
  # default
213
230
  redirect_immediately: nil,
231
+ # If true, the customer's phone number is required to create this subscription.
232
+ # Typically set alongside `payment_link=true` so merchants can enforce phone
233
+ # collection on the hosted payment page. Defaults to false.
234
+ require_phone_number: nil,
214
235
  # Optional URL to redirect after successful subscription creation
215
236
  return_url: nil,
216
237
  # If true, returns a shortened payment link. Defaults to false if not specified.
@@ -244,17 +265,15 @@ module Dodopayments
244
265
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
245
266
  discount_code: T.nilable(String),
246
267
  force_3ds: T.nilable(T::Boolean),
268
+ mandate_min_amount_inr_paise: T.nilable(Integer),
247
269
  metadata: T::Hash[Symbol, String],
248
270
  on_demand: T.nilable(Dodopayments::OnDemandSubscription),
249
271
  one_time_product_cart:
250
- T.nilable(
251
- T::Array[
252
- Dodopayments::SubscriptionCreateParams::OneTimeProductCart
253
- ]
254
- ),
272
+ T.nilable(T::Array[Dodopayments::OneTimeProductCartItem]),
255
273
  payment_link: T.nilable(T::Boolean),
256
274
  payment_method_id: T.nilable(String),
257
275
  redirect_immediately: T::Boolean,
276
+ require_phone_number: T::Boolean,
258
277
  return_url: T.nilable(String),
259
278
  short_link: T.nilable(T::Boolean),
260
279
  show_saved_payment_methods: T::Boolean,
@@ -266,57 +285,6 @@ module Dodopayments
266
285
  end
267
286
  def to_hash
268
287
  end
269
-
270
- class OneTimeProductCart < Dodopayments::Internal::Type::BaseModel
271
- OrHash =
272
- T.type_alias do
273
- T.any(
274
- Dodopayments::SubscriptionCreateParams::OneTimeProductCart,
275
- Dodopayments::Internal::AnyHash
276
- )
277
- end
278
-
279
- sig { returns(String) }
280
- attr_accessor :product_id
281
-
282
- sig { returns(Integer) }
283
- attr_accessor :quantity
284
-
285
- # Amount the customer pays if pay_what_you_want is enabled. If disabled then
286
- # amount will be ignored Represented in the lowest denomination of the currency
287
- # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
288
- sig { returns(T.nilable(Integer)) }
289
- attr_accessor :amount
290
-
291
- sig do
292
- params(
293
- product_id: String,
294
- quantity: Integer,
295
- amount: T.nilable(Integer)
296
- ).returns(T.attached_class)
297
- end
298
- def self.new(
299
- product_id:,
300
- quantity:,
301
- # Amount the customer pays if pay_what_you_want is enabled. If disabled then
302
- # amount will be ignored Represented in the lowest denomination of the currency
303
- # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
304
- amount: nil
305
- )
306
- end
307
-
308
- sig do
309
- override.returns(
310
- {
311
- product_id: String,
312
- quantity: Integer,
313
- amount: T.nilable(Integer)
314
- }
315
- )
316
- end
317
- def to_hash
318
- end
319
- end
320
288
  end
321
289
  end
322
290
  end