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
@@ -189,9 +189,9 @@ module Dodopayments
189
189
  # @!attribute product_cart
190
190
  # List of products purchased in a one-time payment
191
191
  #
192
- # @return [Array<Dodopayments::Models::OneTimeProductCartItem>, nil]
192
+ # @return [Array<Dodopayments::Models::Payment::ProductCart>, nil]
193
193
  optional :product_cart,
194
- -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::OneTimeProductCartItem] },
194
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Payment::ProductCart] },
195
195
  nil?: true
196
196
 
197
197
  # @!attribute refund_status
@@ -295,7 +295,7 @@ module Dodopayments
295
295
  #
296
296
  # @param payment_method_type [String, nil] Specific type of payment method (e.g. "visa", "mastercard")
297
297
  #
298
- # @param product_cart [Array<Dodopayments::Models::OneTimeProductCartItem>, nil] List of products purchased in a one-time payment
298
+ # @param product_cart [Array<Dodopayments::Models::Payment::ProductCart>, nil] List of products purchased in a one-time payment
299
299
  #
300
300
  # @param refund_status [Symbol, Dodopayments::Models::PaymentRefundStatus, nil] Summary of the refund status for this payment. None if no succeeded refunds exis
301
301
  #
@@ -308,6 +308,22 @@ module Dodopayments
308
308
  # @param tax [Integer, nil] Amount of tax collected in smallest currency unit (e.g. cents)
309
309
  #
310
310
  # @param updated_at [Time, nil] Timestamp when the payment was last updated
311
+
312
+ class ProductCart < Dodopayments::Internal::Type::BaseModel
313
+ # @!attribute product_id
314
+ #
315
+ # @return [String]
316
+ required :product_id, String
317
+
318
+ # @!attribute quantity
319
+ #
320
+ # @return [Integer]
321
+ required :quantity, Integer
322
+
323
+ # @!method initialize(product_id:, quantity:)
324
+ # @param product_id [String]
325
+ # @param quantity [Integer]
326
+ end
311
327
  end
312
328
  end
313
329
  end
@@ -22,9 +22,15 @@ module Dodopayments
22
22
  # @!attribute product_cart
23
23
  # List of products in the cart. Must contain at least 1 and at most 100 items.
24
24
  #
25
- # @return [Array<Dodopayments::Models::PaymentCreateParams::ProductCart>]
26
- required :product_cart,
27
- -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::PaymentCreateParams::ProductCart] }
25
+ # @return [Array<Dodopayments::Models::OneTimeProductCartItem>]
26
+ required :product_cart, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::OneTimeProductCartItem] }
27
+
28
+ # @!attribute adaptive_currency_fees_inclusive
29
+ # Whether adaptive currency fees should be included in the price (true) or added
30
+ # on top (false). If not specified, defaults to the business-level setting.
31
+ #
32
+ # @return [Boolean, nil]
33
+ optional :adaptive_currency_fees_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
28
34
 
29
35
  # @!attribute allowed_payment_method_types
30
36
  # List of payment methods allowed during checkout.
@@ -86,6 +92,14 @@ module Dodopayments
86
92
  # @return [Boolean, nil]
87
93
  optional :redirect_immediately, Dodopayments::Internal::Type::Boolean
88
94
 
95
+ # @!attribute require_phone_number
96
+ # If true, the customer's phone number is required to create this payment.
97
+ # Typically set alongside `payment_link=true` so merchants can enforce phone
98
+ # collection on the hosted payment page. Defaults to false.
99
+ #
100
+ # @return [Boolean, nil]
101
+ optional :require_phone_number, Dodopayments::Internal::Type::Boolean
102
+
89
103
  # @!attribute return_url
90
104
  # Optional URL to redirect the customer after payment. Must be a valid URL if
91
105
  # provided.
@@ -112,7 +126,7 @@ module Dodopayments
112
126
  # @return [String, nil]
113
127
  optional :tax_id, String, nil?: true
114
128
 
115
- # @!method initialize(billing:, customer:, product_cart:, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, payment_link: nil, payment_method_id: nil, redirect_immediately: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, request_options: {})
129
+ # @!method initialize(billing:, customer:, product_cart:, adaptive_currency_fees_inclusive: nil, allowed_payment_method_types: nil, billing_currency: nil, discount_code: nil, force_3ds: nil, metadata: nil, payment_link: nil, payment_method_id: nil, redirect_immediately: nil, require_phone_number: nil, return_url: nil, short_link: nil, show_saved_payment_methods: nil, tax_id: nil, request_options: {})
116
130
  # Some parameter documentations has been truncated, see
117
131
  # {Dodopayments::Models::PaymentCreateParams} for more details.
118
132
  #
@@ -120,7 +134,9 @@ module Dodopayments
120
134
  #
121
135
  # @param customer [Dodopayments::Models::AttachExistingCustomer, Dodopayments::Models::NewCustomer] Customer information for the payment
122
136
  #
123
- # @param product_cart [Array<Dodopayments::Models::PaymentCreateParams::ProductCart>] List of products in the cart. Must contain at least 1 and at most 100 items.
137
+ # @param product_cart [Array<Dodopayments::Models::OneTimeProductCartItem>] List of products in the cart. Must contain at least 1 and at most 100 items.
138
+ #
139
+ # @param adaptive_currency_fees_inclusive [Boolean, nil] Whether adaptive currency fees should be included in the price (true) or added o
124
140
  #
125
141
  # @param allowed_payment_method_types [Array<Symbol, Dodopayments::Models::PaymentMethodTypes>, nil] List of payment methods allowed during checkout.
126
142
  #
@@ -138,6 +154,8 @@ module Dodopayments
138
154
  #
139
155
  # @param redirect_immediately [Boolean] If true, redirects the customer immediately after payment completion
140
156
  #
157
+ # @param require_phone_number [Boolean] If true, the customer's phone number is required to create this payment.
158
+ #
141
159
  # @param return_url [String, nil] Optional URL to redirect the customer after payment.
142
160
  #
143
161
  # @param short_link [Boolean, nil] If true, returns a shortened payment link.
@@ -147,36 +165,6 @@ module Dodopayments
147
165
  # @param tax_id [String, nil] Tax ID in case the payment is B2B. If tax id validation fails the payment creati
148
166
  #
149
167
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
150
-
151
- class ProductCart < Dodopayments::Internal::Type::BaseModel
152
- # @!attribute product_id
153
- #
154
- # @return [String]
155
- required :product_id, String
156
-
157
- # @!attribute quantity
158
- #
159
- # @return [Integer]
160
- required :quantity, Integer
161
-
162
- # @!attribute amount
163
- # Amount the customer pays if pay_what_you_want is enabled. If disabled then
164
- # amount will be ignored Represented in the lowest denomination of the currency
165
- # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
166
- #
167
- # @return [Integer, nil]
168
- optional :amount, Integer, nil?: true
169
-
170
- # @!method initialize(product_id:, quantity:, amount: nil)
171
- # Some parameter documentations has been truncated, see
172
- # {Dodopayments::Models::PaymentCreateParams::ProductCart} for more details.
173
- #
174
- # @param product_id [String]
175
- #
176
- # @param quantity [Integer]
177
- #
178
- # @param amount [Integer, nil] Amount the customer pays if pay_what_you_want is enabled. If disabled then amoun
179
- end
180
168
  end
181
169
  end
182
170
  end
@@ -56,9 +56,9 @@ module Dodopayments
56
56
  # @!attribute product_cart
57
57
  # Optional list of products included in the payment
58
58
  #
59
- # @return [Array<Dodopayments::Models::PaymentCreateResponse::ProductCart>, nil]
59
+ # @return [Array<Dodopayments::Models::OneTimeProductCartItem>, nil]
60
60
  optional :product_cart,
61
- -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Models::PaymentCreateResponse::ProductCart] },
61
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::OneTimeProductCartItem] },
62
62
  nil?: true
63
63
 
64
64
  # @!method initialize(client_secret:, customer:, metadata:, payment_id:, total_amount:, discount_id: nil, expires_on: nil, payment_link: nil, product_cart: nil)
@@ -81,37 +81,7 @@ module Dodopayments
81
81
  #
82
82
  # @param payment_link [String, nil] Optional URL to a hosted payment page
83
83
  #
84
- # @param product_cart [Array<Dodopayments::Models::PaymentCreateResponse::ProductCart>, nil] Optional list of products included in the payment
85
-
86
- class ProductCart < Dodopayments::Internal::Type::BaseModel
87
- # @!attribute product_id
88
- #
89
- # @return [String]
90
- required :product_id, String
91
-
92
- # @!attribute quantity
93
- #
94
- # @return [Integer]
95
- required :quantity, Integer
96
-
97
- # @!attribute amount
98
- # Amount the customer pays if pay_what_you_want is enabled. If disabled then
99
- # amount will be ignored Represented in the lowest denomination of the currency
100
- # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
101
- #
102
- # @return [Integer, nil]
103
- optional :amount, Integer, nil?: true
104
-
105
- # @!method initialize(product_id:, quantity:, amount: nil)
106
- # Some parameter documentations has been truncated, see
107
- # {Dodopayments::Models::PaymentCreateResponse::ProductCart} for more details.
108
- #
109
- # @param product_id [String]
110
- #
111
- # @param quantity [Integer]
112
- #
113
- # @param amount [Integer, nil] Amount the customer pays if pay_what_you_want is enabled. If disabled then amoun
114
- end
84
+ # @param product_cart [Array<Dodopayments::Models::OneTimeProductCartItem>, nil] Optional list of products included in the payment
115
85
  end
116
86
  end
117
87
  end
@@ -31,8 +31,9 @@ module Dodopayments
31
31
  # @!attribute entitlements
32
32
  # Attached entitlements (integration-based access grants)
33
33
  #
34
- # @return [Array<Dodopayments::Models::Product::Entitlement>]
35
- required :entitlements, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Product::Entitlement] }
34
+ # @return [Array<Dodopayments::Models::ProductEntitlementSummary>]
35
+ required :entitlements,
36
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::ProductEntitlementSummary] }
36
37
 
37
38
  # @!attribute is_recurring
38
39
  # Indicates if the product is recurring (e.g., subscriptions).
@@ -91,6 +92,8 @@ module Dodopayments
91
92
  optional :description, String, nil?: true
92
93
 
93
94
  # @!attribute digital_product_delivery
95
+ # Digital-product-delivery payload, present on grants for `digital_files`
96
+ # entitlements. Each file carries a short-lived presigned download URL.
94
97
  #
95
98
  # @return [Dodopayments::Models::DigitalProductDelivery, nil]
96
99
  optional :digital_product_delivery, -> { Dodopayments::DigitalProductDelivery }, nil?: true
@@ -136,6 +139,9 @@ module Dodopayments
136
139
  optional :product_collection_id, String, nil?: true
137
140
 
138
141
  # @!method initialize(brand_id:, business_id:, created_at:, credit_entitlements:, entitlements:, is_recurring:, license_key_enabled:, metadata:, price:, product_id:, tax_category:, updated_at:, addons: nil, description: nil, digital_product_delivery: nil, image: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, name: nil, product_collection_id: nil)
142
+ # Some parameter documentations has been truncated, see
143
+ # {Dodopayments::Models::Product} for more details.
144
+ #
139
145
  # @param brand_id [String]
140
146
  #
141
147
  # @param business_id [String] Unique identifier for the business to which the product belongs.
@@ -144,7 +150,7 @@ module Dodopayments
144
150
  #
145
151
  # @param credit_entitlements [Array<Dodopayments::Models::CreditEntitlementMappingResponse>] Attached credit entitlements with settings
146
152
  #
147
- # @param entitlements [Array<Dodopayments::Models::Product::Entitlement>] Attached entitlements (integration-based access grants)
153
+ # @param entitlements [Array<Dodopayments::Models::ProductEntitlementSummary>] Attached entitlements (integration-based access grants)
148
154
  #
149
155
  # @param is_recurring [Boolean] Indicates if the product is recurring (e.g., subscriptions).
150
156
  #
@@ -164,7 +170,7 @@ module Dodopayments
164
170
  #
165
171
  # @param description [String, nil] Description of the product, optional.
166
172
  #
167
- # @param digital_product_delivery [Dodopayments::Models::DigitalProductDelivery, nil]
173
+ # @param digital_product_delivery [Dodopayments::Models::DigitalProductDelivery, nil] Digital-product-delivery payload, present on grants for `digital_files`
168
174
  #
169
175
  # @param image [String, nil] URL of the product image, optional.
170
176
  #
@@ -177,219 +183,6 @@ module Dodopayments
177
183
  # @param name [String, nil] Name of the product, optional.
178
184
  #
179
185
  # @param product_collection_id [String, nil] The product collection ID this product belongs to, if any
180
-
181
- class Entitlement < Dodopayments::Internal::Type::BaseModel
182
- # @!attribute id
183
- #
184
- # @return [String]
185
- required :id, String
186
-
187
- # @!attribute integration_config
188
- # Platform-specific configuration for an entitlement. Each variant uses unique
189
- # field names so `#[serde(untagged)]` can disambiguate correctly.
190
- #
191
- # @return [Dodopayments::Models::Product::Entitlement::IntegrationConfig::GitHubConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::DiscordConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::TelegramConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::FigmaConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::FramerConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::NotionConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::LicenseKeyConfig]
192
- required :integration_config, union: -> { Dodopayments::Product::Entitlement::IntegrationConfig }
193
-
194
- # @!attribute integration_type
195
- #
196
- # @return [Symbol, Dodopayments::Models::Product::Entitlement::IntegrationType]
197
- required :integration_type, enum: -> { Dodopayments::Product::Entitlement::IntegrationType }
198
-
199
- # @!attribute name
200
- #
201
- # @return [String]
202
- required :name, String
203
-
204
- # @!attribute description
205
- #
206
- # @return [String, nil]
207
- optional :description, String, nil?: true
208
-
209
- # @!method initialize(id:, integration_config:, integration_type:, name:, description: nil)
210
- # Some parameter documentations has been truncated, see
211
- # {Dodopayments::Models::Product::Entitlement} for more details.
212
- #
213
- # Summary of an entitlement attached to a product
214
- #
215
- # @param id [String]
216
- #
217
- # @param integration_config [Dodopayments::Models::Product::Entitlement::IntegrationConfig::GitHubConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::DiscordConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::TelegramConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::FigmaConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::FramerConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::NotionConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::LicenseKeyConfig] Platform-specific configuration for an entitlement.
218
- #
219
- # @param integration_type [Symbol, Dodopayments::Models::Product::Entitlement::IntegrationType]
220
- #
221
- # @param name [String]
222
- #
223
- # @param description [String, nil]
224
-
225
- # Platform-specific configuration for an entitlement. Each variant uses unique
226
- # field names so `#[serde(untagged)]` can disambiguate correctly.
227
- #
228
- # @see Dodopayments::Models::Product::Entitlement#integration_config
229
- module IntegrationConfig
230
- extend Dodopayments::Internal::Type::Union
231
-
232
- variant -> { Dodopayments::Product::Entitlement::IntegrationConfig::GitHubConfig }
233
-
234
- variant -> { Dodopayments::Product::Entitlement::IntegrationConfig::DiscordConfig }
235
-
236
- variant -> { Dodopayments::Product::Entitlement::IntegrationConfig::TelegramConfig }
237
-
238
- variant -> { Dodopayments::Product::Entitlement::IntegrationConfig::FigmaConfig }
239
-
240
- variant -> { Dodopayments::Product::Entitlement::IntegrationConfig::FramerConfig }
241
-
242
- variant -> { Dodopayments::Product::Entitlement::IntegrationConfig::NotionConfig }
243
-
244
- variant -> { Dodopayments::Product::Entitlement::IntegrationConfig::DigitalFilesConfig }
245
-
246
- variant -> { Dodopayments::Product::Entitlement::IntegrationConfig::LicenseKeyConfig }
247
-
248
- class GitHubConfig < Dodopayments::Internal::Type::BaseModel
249
- # @!attribute permission
250
- # One of: pull, push, admin, maintain, triage
251
- #
252
- # @return [String]
253
- required :permission, String
254
-
255
- # @!attribute target_id
256
- #
257
- # @return [String]
258
- required :target_id, String
259
-
260
- # @!method initialize(permission:, target_id:)
261
- # @param permission [String] One of: pull, push, admin, maintain, triage
262
- #
263
- # @param target_id [String]
264
- end
265
-
266
- class DiscordConfig < Dodopayments::Internal::Type::BaseModel
267
- # @!attribute guild_id
268
- #
269
- # @return [String]
270
- required :guild_id, String
271
-
272
- # @!attribute role_id
273
- #
274
- # @return [String, nil]
275
- optional :role_id, String, nil?: true
276
-
277
- # @!method initialize(guild_id:, role_id: nil)
278
- # @param guild_id [String]
279
- # @param role_id [String, nil]
280
- end
281
-
282
- class TelegramConfig < Dodopayments::Internal::Type::BaseModel
283
- # @!attribute chat_id
284
- #
285
- # @return [String]
286
- required :chat_id, String
287
-
288
- # @!method initialize(chat_id:)
289
- # @param chat_id [String]
290
- end
291
-
292
- class FigmaConfig < Dodopayments::Internal::Type::BaseModel
293
- # @!attribute figma_file_id
294
- #
295
- # @return [String]
296
- required :figma_file_id, String
297
-
298
- # @!method initialize(figma_file_id:)
299
- # @param figma_file_id [String]
300
- end
301
-
302
- class FramerConfig < Dodopayments::Internal::Type::BaseModel
303
- # @!attribute framer_template_id
304
- #
305
- # @return [String]
306
- required :framer_template_id, String
307
-
308
- # @!method initialize(framer_template_id:)
309
- # @param framer_template_id [String]
310
- end
311
-
312
- class NotionConfig < Dodopayments::Internal::Type::BaseModel
313
- # @!attribute notion_template_id
314
- #
315
- # @return [String]
316
- required :notion_template_id, String
317
-
318
- # @!method initialize(notion_template_id:)
319
- # @param notion_template_id [String]
320
- end
321
-
322
- class DigitalFilesConfig < Dodopayments::Internal::Type::BaseModel
323
- # @!attribute digital_file_ids
324
- #
325
- # @return [Array<String>]
326
- required :digital_file_ids, Dodopayments::Internal::Type::ArrayOf[String]
327
-
328
- # @!attribute external_url
329
- #
330
- # @return [String, nil]
331
- optional :external_url, String, nil?: true
332
-
333
- # @!attribute instructions
334
- #
335
- # @return [String, nil]
336
- optional :instructions, String, nil?: true
337
-
338
- # @!method initialize(digital_file_ids:, external_url: nil, instructions: nil)
339
- # @param digital_file_ids [Array<String>]
340
- # @param external_url [String, nil]
341
- # @param instructions [String, nil]
342
- end
343
-
344
- class LicenseKeyConfig < Dodopayments::Internal::Type::BaseModel
345
- # @!attribute activation_message
346
- #
347
- # @return [String, nil]
348
- optional :activation_message, String, nil?: true
349
-
350
- # @!attribute activations_limit
351
- #
352
- # @return [Integer, nil]
353
- optional :activations_limit, Integer, nil?: true
354
-
355
- # @!attribute duration_count
356
- #
357
- # @return [Integer, nil]
358
- optional :duration_count, Integer, nil?: true
359
-
360
- # @!attribute duration_interval
361
- #
362
- # @return [String, nil]
363
- optional :duration_interval, String, nil?: true
364
-
365
- # @!method initialize(activation_message: nil, activations_limit: nil, duration_count: nil, duration_interval: nil)
366
- # @param activation_message [String, nil]
367
- # @param activations_limit [Integer, nil]
368
- # @param duration_count [Integer, nil]
369
- # @param duration_interval [String, nil]
370
- end
371
-
372
- # @!method self.variants
373
- # @return [Array(Dodopayments::Models::Product::Entitlement::IntegrationConfig::GitHubConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::DiscordConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::TelegramConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::FigmaConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::FramerConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::NotionConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::Product::Entitlement::IntegrationConfig::LicenseKeyConfig)]
374
- end
375
-
376
- # @see Dodopayments::Models::Product::Entitlement#integration_type
377
- module IntegrationType
378
- extend Dodopayments::Internal::Type::Enum
379
-
380
- DISCORD = :discord
381
- TELEGRAM = :telegram
382
- GITHUB = :github
383
- FIGMA = :figma
384
- FRAMER = :framer
385
- NOTION = :notion
386
- DIGITAL_FILES = :digital_files
387
- LICENSE_KEY = :license_key
388
-
389
- # @!method self.values
390
- # @return [Array<Symbol>]
391
- end
392
- end
393
186
  end
394
187
  end
395
188
  end
@@ -54,22 +54,29 @@ module Dodopayments
54
54
  # @!attribute digital_product_delivery
55
55
  # Choose how you would like you digital product delivered
56
56
  #
57
+ # deprecated: use entitlements instead
58
+ #
57
59
  # @return [Dodopayments::Models::ProductCreateParams::DigitalProductDelivery, nil]
58
60
  optional :digital_product_delivery,
59
61
  -> { Dodopayments::ProductCreateParams::DigitalProductDelivery },
60
62
  nil?: true
61
63
 
62
- # @!attribute entitlement_ids
63
- # Optional entitlement IDs to attach to this product (max 20)
64
+ # @!attribute entitlements
65
+ # Optional entitlements to attach to this product (max 20)
64
66
  #
65
- # @return [Array<String>, nil]
66
- optional :entitlement_ids, Dodopayments::Internal::Type::ArrayOf[String], nil?: true
67
+ # @return [Array<Dodopayments::Models::AttachProductEntitlement>, nil]
68
+ optional :entitlements,
69
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::AttachProductEntitlement] },
70
+ nil?: true
67
71
 
68
72
  # @!attribute license_key_activation_message
69
73
  # @deprecated
70
74
  #
71
75
  # Optional message displayed during license key activation
72
76
  #
77
+ # deprecated: use entitlements instead. Ignored when a `license_key` entitlement
78
+ # is attached via the `entitlements` field.
79
+ #
73
80
  # @return [String, nil]
74
81
  optional :license_key_activation_message, String, nil?: true
75
82
 
@@ -78,6 +85,9 @@ module Dodopayments
78
85
  #
79
86
  # The number of times the license key can be activated. Must be 0 or greater
80
87
  #
88
+ # deprecated: use entitlements instead. Ignored when a `license_key` entitlement
89
+ # is attached via the `entitlements` field.
90
+ #
81
91
  # @return [Integer, nil]
82
92
  optional :license_key_activations_limit, Integer, nil?: true
83
93
 
@@ -86,6 +96,9 @@ module Dodopayments
86
96
  # license key to expire. For subscriptions, the lifetime of the license key is
87
97
  # tied to the subscription period
88
98
  #
99
+ # deprecated: use entitlements instead. Ignored when a `license_key` entitlement
100
+ # is attached via the `entitlements` field.
101
+ #
89
102
  # @return [Dodopayments::Models::LicenseKeyDuration, nil]
90
103
  optional :license_key_duration, -> { Dodopayments::LicenseKeyDuration }, nil?: true
91
104
 
@@ -94,6 +107,10 @@ module Dodopayments
94
107
  #
95
108
  # When true, generates and sends a license key to your customer. Defaults to false
96
109
  #
110
+ # deprecated: use entitlements instead. If a `license_key` entitlement is also
111
+ # attached via the `entitlements` field, the `license_key_*` config fields below
112
+ # are ignored — the attached entitlement's config is the source of truth.
113
+ #
97
114
  # @return [Boolean, nil]
98
115
  optional :license_key_enabled, Dodopayments::Internal::Type::Boolean, nil?: true
99
116
 
@@ -103,7 +120,7 @@ module Dodopayments
103
120
  # @return [Hash{Symbol=>String}, nil]
104
121
  optional :metadata, Dodopayments::Internal::Type::HashOf[String]
105
122
 
106
- # @!method initialize(name:, price:, tax_category:, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, entitlement_ids: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, request_options: {})
123
+ # @!method initialize(name:, price:, tax_category:, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, entitlements: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, request_options: {})
107
124
  # Some parameter documentations has been truncated, see
108
125
  # {Dodopayments::Models::ProductCreateParams} for more details.
109
126
  #
@@ -123,7 +140,7 @@ module Dodopayments
123
140
  #
124
141
  # @param digital_product_delivery [Dodopayments::Models::ProductCreateParams::DigitalProductDelivery, nil] Choose how you would like you digital product delivered
125
142
  #
126
- # @param entitlement_ids [Array<String>, nil] Optional entitlement IDs to attach to this product (max 20)
143
+ # @param entitlements [Array<Dodopayments::Models::AttachProductEntitlement>, nil] Optional entitlements to attach to this product (max 20)
127
144
  #
128
145
  # @param license_key_activation_message [String, nil] Optional message displayed during license key activation
129
146
  #
@@ -153,6 +170,8 @@ module Dodopayments
153
170
  # @!method initialize(external_url: nil, instructions: nil)
154
171
  # Choose how you would like you digital product delivered
155
172
  #
173
+ # deprecated: use entitlements instead
174
+ #
156
175
  # @param external_url [String, nil] External URL to digital product
157
176
  #
158
177
  # @param instructions [String, nil] Instructions to download and use the digital product
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class ProductEntitlementSummary < Dodopayments::Internal::Type::BaseModel
6
+ # @!attribute id
7
+ #
8
+ # @return [String]
9
+ required :id, String
10
+
11
+ # @!attribute integration_config
12
+ # Integration-specific configuration on an entitlement read response.
13
+ #
14
+ # For `digital_files` entitlements the response includes presigned download URLs
15
+ # for each attached file; other integrations match the shape supplied at creation.
16
+ #
17
+ # @return [Dodopayments::Models::IntegrationConfigResponse::GitHubConfig, Dodopayments::Models::IntegrationConfigResponse::DiscordConfig, Dodopayments::Models::IntegrationConfigResponse::TelegramConfig, Dodopayments::Models::IntegrationConfigResponse::FigmaConfig, Dodopayments::Models::IntegrationConfigResponse::FramerConfig, Dodopayments::Models::IntegrationConfigResponse::NotionConfig, Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig, Dodopayments::Models::IntegrationConfigResponse::LicenseKeyConfig]
18
+ required :integration_config, union: -> { Dodopayments::IntegrationConfigResponse }
19
+
20
+ # @!attribute integration_type
21
+ #
22
+ # @return [Symbol, Dodopayments::Models::EntitlementIntegrationType]
23
+ required :integration_type, enum: -> { Dodopayments::EntitlementIntegrationType }
24
+
25
+ # @!attribute name
26
+ #
27
+ # @return [String]
28
+ required :name, String
29
+
30
+ # @!attribute description
31
+ #
32
+ # @return [String, nil]
33
+ optional :description, String, nil?: true
34
+
35
+ # @!method initialize(id:, integration_config:, integration_type:, name:, description: nil)
36
+ # Some parameter documentations has been truncated, see
37
+ # {Dodopayments::Models::ProductEntitlementSummary} for more details.
38
+ #
39
+ # Summary of an entitlement attached to a product.
40
+ #
41
+ # `integration_config` uses [`IntegrationConfigResponse`] (NOT the persisted
42
+ # [`IntegrationConfig`]) so digital_files entitlements embed the resolved
43
+ # `digital_files` object — matching what `GET /entitlements/{id}` returns. All
44
+ # other variants pass through unchanged via `#[serde(untagged)]`.
45
+ #
46
+ # @param id [String]
47
+ #
48
+ # @param integration_config [Dodopayments::Models::IntegrationConfigResponse::GitHubConfig, Dodopayments::Models::IntegrationConfigResponse::DiscordConfig, Dodopayments::Models::IntegrationConfigResponse::TelegramConfig, Dodopayments::Models::IntegrationConfigResponse::FigmaConfig, Dodopayments::Models::IntegrationConfigResponse::FramerConfig, Dodopayments::Models::IntegrationConfigResponse::NotionConfig, Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig, Dodopayments::Models::IntegrationConfigResponse::LicenseKeyConfig] Integration-specific configuration on an entitlement read response.
49
+ #
50
+ # @param integration_type [Symbol, Dodopayments::Models::EntitlementIntegrationType]
51
+ #
52
+ # @param name [String]
53
+ #
54
+ # @param description [String, nil]
55
+ end
56
+ end
57
+ end