dodopayments 2.8.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +13 -15
  14. data/lib/dodopayments/models/digital_product_delivery_file.rb +32 -8
  15. data/lib/dodopayments/models/entitlement.rb +86 -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 +51 -0
  19. data/lib/dodopayments/models/entitlement_grant_delivered_webhook_event.rb +51 -0
  20. data/lib/dodopayments/models/entitlement_grant_failed_webhook_event.rb +51 -0
  21. data/lib/dodopayments/models/entitlement_grant_revoked_webhook_event.rb +51 -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 +172 -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 +40 -0
  33. data/lib/dodopayments/models/integration_config.rb +174 -0
  34. data/lib/dodopayments/models/integration_config_response.rb +238 -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 +12 -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 +2 -154
  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 +70 -0
  60. data/lib/dodopayments/resources/entitlements/grants.rb +78 -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 +10 -22
  79. data/rbi/dodopayments/models/digital_product_delivery_file.rbi +40 -8
  80. data/rbi/dodopayments/models/entitlement.rbi +112 -0
  81. data/rbi/dodopayments/models/entitlement_create_params.rbi +112 -0
  82. data/rbi/dodopayments/models/entitlement_delete_params.rbi +38 -0
  83. data/rbi/dodopayments/models/entitlement_grant_created_webhook_event.rbi +103 -0
  84. data/rbi/dodopayments/models/entitlement_grant_delivered_webhook_event.rbi +103 -0
  85. data/rbi/dodopayments/models/entitlement_grant_failed_webhook_event.rbi +102 -0
  86. data/rbi/dodopayments/models/entitlement_grant_revoked_webhook_event.rbi +103 -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 +235 -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 +62 -0
  98. data/rbi/dodopayments/models/integration_config.rbi +296 -0
  99. data/rbi/dodopayments/models/integration_config_response.rbi +416 -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 +12 -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 +4 -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 +52 -0
  125. data/rbi/dodopayments/resources/entitlements/grants.rbi +65 -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 +67 -0
  144. data/sig/dodopayments/models/entitlement_create_params.rbs +46 -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 +134 -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 +147 -0
  162. data/sig/dodopayments/models/integration_config_response.rbs +206 -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
@@ -25,6 +25,7 @@ module Dodopayments
25
25
  discount_code: T.nilable(String),
26
26
  feature_flags: Dodopayments::CheckoutSessionFlags::OrHash,
27
27
  force_3ds: T.nilable(T::Boolean),
28
+ mandate_min_amount_inr_paise: T.nilable(Integer),
28
29
  metadata: T.nilable(T::Hash[Symbol, String]),
29
30
  minimal_address: T::Boolean,
30
31
  payment_method_id: T.nilable(String),
@@ -66,6 +67,13 @@ module Dodopayments
66
67
  feature_flags: nil,
67
68
  # Override merchant default 3DS behaviour for this session
68
69
  force_3ds: nil,
70
+ # Override the merchant-level mandate floor (in INR paise) for INR e-mandates on
71
+ # Indian-card recurring payments. The mandate amount sent to the processor is
72
+ # `max(this_floor, actual_billing_amount)`, so this is effectively the
73
+ # customer-facing authorization ceiling whenever billing is lower. When unset, the
74
+ # merchant setting applies; when that's also unset, the system default of ₹15,000
75
+ # applies.
76
+ mandate_min_amount_inr_paise: nil,
69
77
  # Additional metadata associated with the payment. Defaults to empty if not
70
78
  # provided.
71
79
  metadata: nil,
@@ -122,6 +130,7 @@ module Dodopayments
122
130
  discount_code: T.nilable(String),
123
131
  feature_flags: Dodopayments::CheckoutSessionFlags::OrHash,
124
132
  force_3ds: T.nilable(T::Boolean),
133
+ mandate_min_amount_inr_paise: T.nilable(Integer),
125
134
  metadata: T.nilable(T::Hash[Symbol, String]),
126
135
  minimal_address: T::Boolean,
127
136
  payment_method_id: T.nilable(String),
@@ -163,6 +172,13 @@ module Dodopayments
163
172
  feature_flags: nil,
164
173
  # Override merchant default 3DS behaviour for this session
165
174
  force_3ds: nil,
175
+ # Override the merchant-level mandate floor (in INR paise) for INR e-mandates on
176
+ # Indian-card recurring payments. The mandate amount sent to the processor is
177
+ # `max(this_floor, actual_billing_amount)`, so this is effectively the
178
+ # customer-facing authorization ceiling whenever billing is lower. When unset, the
179
+ # merchant setting applies; when that's also unset, the system default of ₹15,000
180
+ # applies.
181
+ mandate_min_amount_inr_paise: nil,
166
182
  # Additional metadata associated with the payment. Defaults to empty if not
167
183
  # provided.
168
184
  metadata: nil,
@@ -125,6 +125,20 @@ module Dodopayments
125
125
  )
126
126
  end
127
127
 
128
+ # List all entitlement grants delivered (or in flight) to a customer.
129
+ sig do
130
+ params(
131
+ customer_id: String,
132
+ request_options: Dodopayments::RequestOptions::OrHash
133
+ ).returns(Dodopayments::Models::CustomerListEntitlementsResponse)
134
+ end
135
+ def list_entitlements(
136
+ # Customer ID
137
+ customer_id,
138
+ request_options: {}
139
+ )
140
+ end
141
+
128
142
  sig do
129
143
  params(
130
144
  customer_id: String,
@@ -0,0 +1,52 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Entitlements
6
+ class Files
7
+ # Companion to `post_entitlement_file`. Deletes the file from the Entitlements
8
+ # Engine (force=true) and atomically removes the `file_id` from the entitlement's
9
+ # `integration_config.digital_file_ids` JSONB array. EE delete happens first; if
10
+ # it fails we surface the error and leave local state untouched.
11
+ sig do
12
+ params(
13
+ file_id: String,
14
+ id: String,
15
+ request_options: Dodopayments::RequestOptions::OrHash
16
+ ).void
17
+ end
18
+ def delete(
19
+ # Digital file Id from EE
20
+ file_id,
21
+ # Entitlement Id
22
+ id:,
23
+ request_options: {}
24
+ )
25
+ end
26
+
27
+ # Streams a multipart/form-data body to the Entitlements Engine
28
+ # (`POST /api/digital-files/dodo/files/upload`) and appends the returned `file_id`
29
+ # to the entitlement's `integration_config.digital_file_ids` using a JSONB array
30
+ # append. Compensates EE-side on local DB write failure (best-effort delete of the
31
+ # just-uploaded file).
32
+ sig do
33
+ params(
34
+ id: String,
35
+ request_options: Dodopayments::RequestOptions::OrHash
36
+ ).returns(Dodopayments::Models::Entitlements::FileUploadResponse)
37
+ end
38
+ def upload(
39
+ # Entitlement Id
40
+ id,
41
+ request_options: {}
42
+ )
43
+ end
44
+
45
+ # @api private
46
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
47
+ def self.new(client:)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,65 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Entitlements
6
+ class Grants
7
+ # GET /entitlements/{id}/grants (public API)
8
+ sig do
9
+ params(
10
+ id: String,
11
+ customer_id: String,
12
+ page_number: Integer,
13
+ page_size: Integer,
14
+ status:
15
+ Dodopayments::Entitlements::GrantListParams::Status::OrSymbol,
16
+ request_options: Dodopayments::RequestOptions::OrHash
17
+ ).returns(
18
+ Dodopayments::Internal::DefaultPageNumberPagination[
19
+ Dodopayments::Entitlements::EntitlementGrant
20
+ ]
21
+ )
22
+ end
23
+ def list(
24
+ # Entitlement ID
25
+ id,
26
+ # Filter by customer ID
27
+ customer_id: nil,
28
+ # Page number (default 0)
29
+ page_number: nil,
30
+ # Page size (default 10, max 100)
31
+ page_size: nil,
32
+ # Filter by grant status
33
+ status: nil,
34
+ request_options: {}
35
+ )
36
+ end
37
+
38
+ # Revokes a single entitlement grant for the caller's business. For LicenseKey
39
+ # integrations, also disables the backing license key. Idempotent: re-revoking an
40
+ # already-revoked grant returns 200 with current state. The revocation reason is
41
+ # always set to "manual" for API-initiated revocations.
42
+ sig do
43
+ params(
44
+ grant_id: String,
45
+ id: String,
46
+ request_options: Dodopayments::RequestOptions::OrHash
47
+ ).returns(Dodopayments::Entitlements::EntitlementGrant)
48
+ end
49
+ def revoke(
50
+ # Grant ID
51
+ grant_id,
52
+ # Entitlement ID
53
+ id:,
54
+ request_options: {}
55
+ )
56
+ end
57
+
58
+ # @api private
59
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
60
+ def self.new(client:)
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,143 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Entitlements
6
+ sig { returns(Dodopayments::Resources::Entitlements::Files) }
7
+ attr_reader :files
8
+
9
+ sig { returns(Dodopayments::Resources::Entitlements::Grants) }
10
+ attr_reader :grants
11
+
12
+ # POST /entitlements
13
+ sig do
14
+ params(
15
+ integration_config:
16
+ T.any(
17
+ Dodopayments::IntegrationConfig::GitHubConfig::OrHash,
18
+ Dodopayments::IntegrationConfig::DiscordConfig::OrHash,
19
+ Dodopayments::IntegrationConfig::TelegramConfig::OrHash,
20
+ Dodopayments::IntegrationConfig::FigmaConfig::OrHash,
21
+ Dodopayments::IntegrationConfig::FramerConfig::OrHash,
22
+ Dodopayments::IntegrationConfig::NotionConfig::OrHash,
23
+ Dodopayments::IntegrationConfig::DigitalFilesConfig::OrHash,
24
+ Dodopayments::IntegrationConfig::LicenseKeyConfig::OrHash
25
+ ),
26
+ integration_type: Dodopayments::EntitlementIntegrationType::OrSymbol,
27
+ name: String,
28
+ description: T.nilable(String),
29
+ metadata: T.nilable(T::Hash[Symbol, String]),
30
+ request_options: Dodopayments::RequestOptions::OrHash
31
+ ).returns(Dodopayments::Entitlement)
32
+ end
33
+ def create(
34
+ # Platform-specific configuration (validated per integration_type)
35
+ integration_config:,
36
+ # Which platform integration this entitlement uses
37
+ integration_type:,
38
+ # Display name for this entitlement
39
+ name:,
40
+ # Optional description
41
+ description: nil,
42
+ # Optional user-facing metadata
43
+ metadata: nil,
44
+ request_options: {}
45
+ )
46
+ end
47
+
48
+ # GET /entitlements/{id}
49
+ sig do
50
+ params(
51
+ id: String,
52
+ request_options: Dodopayments::RequestOptions::OrHash
53
+ ).returns(Dodopayments::Entitlement)
54
+ end
55
+ def retrieve(
56
+ # Entitlement ID
57
+ id,
58
+ request_options: {}
59
+ )
60
+ end
61
+
62
+ # PATCH /entitlements/{id}
63
+ sig do
64
+ params(
65
+ id: String,
66
+ description: T.nilable(String),
67
+ integration_config:
68
+ T.nilable(
69
+ T.any(
70
+ Dodopayments::IntegrationConfig::GitHubConfig::OrHash,
71
+ Dodopayments::IntegrationConfig::DiscordConfig::OrHash,
72
+ Dodopayments::IntegrationConfig::TelegramConfig::OrHash,
73
+ Dodopayments::IntegrationConfig::FigmaConfig::OrHash,
74
+ Dodopayments::IntegrationConfig::FramerConfig::OrHash,
75
+ Dodopayments::IntegrationConfig::NotionConfig::OrHash,
76
+ Dodopayments::IntegrationConfig::DigitalFilesConfig::OrHash,
77
+ Dodopayments::IntegrationConfig::LicenseKeyConfig::OrHash
78
+ )
79
+ ),
80
+ metadata: T.nilable(T::Hash[Symbol, String]),
81
+ name: T.nilable(String),
82
+ request_options: Dodopayments::RequestOptions::OrHash
83
+ ).returns(Dodopayments::Entitlement)
84
+ end
85
+ def update(
86
+ # Entitlement ID
87
+ id,
88
+ description: nil,
89
+ # Platform-specific configuration for an entitlement. Each variant uses unique
90
+ # field names so `#[serde(untagged)]` can disambiguate correctly.
91
+ integration_config: nil,
92
+ metadata: nil,
93
+ name: nil,
94
+ request_options: {}
95
+ )
96
+ end
97
+
98
+ # GET /entitlements
99
+ sig do
100
+ params(
101
+ integration_type:
102
+ Dodopayments::EntitlementListParams::IntegrationType::OrSymbol,
103
+ page_number: Integer,
104
+ page_size: Integer,
105
+ request_options: Dodopayments::RequestOptions::OrHash
106
+ ).returns(
107
+ Dodopayments::Internal::DefaultPageNumberPagination[
108
+ Dodopayments::Entitlement
109
+ ]
110
+ )
111
+ end
112
+ def list(
113
+ # Filter by integration type
114
+ integration_type: nil,
115
+ # Page number (default 0)
116
+ page_number: nil,
117
+ # Page size (default 10, max 100)
118
+ page_size: nil,
119
+ request_options: {}
120
+ )
121
+ end
122
+
123
+ # DELETE /entitlements/{id} (soft-delete)
124
+ sig do
125
+ params(
126
+ id: String,
127
+ request_options: Dodopayments::RequestOptions::OrHash
128
+ ).void
129
+ end
130
+ def delete(
131
+ # Entitlement ID
132
+ id,
133
+ request_options: {}
134
+ )
135
+ end
136
+
137
+ # @api private
138
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
139
+ def self.new(client:)
140
+ end
141
+ end
142
+ end
143
+ end
@@ -33,6 +33,7 @@ module Dodopayments
33
33
 
34
34
  sig do
35
35
  params(
36
+ grant_id: T.nilable(String),
36
37
  license_key_id: T.nilable(String),
37
38
  page_number: T.nilable(Integer),
38
39
  page_size: T.nilable(Integer),
@@ -44,6 +45,8 @@ module Dodopayments
44
45
  )
45
46
  end
46
47
  def list(
48
+ # Filter instances by entitlement grant ID
49
+ grant_id: nil,
47
50
  # Filter by license key ID
48
51
  license_key_id: nil,
49
52
  # Page number default is 0
@@ -11,8 +11,8 @@ module Dodopayments
11
11
  Dodopayments::AttachExistingCustomer::OrHash,
12
12
  Dodopayments::NewCustomer::OrHash
13
13
  ),
14
- product_cart:
15
- T::Array[Dodopayments::PaymentCreateParams::ProductCart::OrHash],
14
+ product_cart: T::Array[Dodopayments::OneTimeProductCartItem::OrHash],
15
+ adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
16
16
  allowed_payment_method_types:
17
17
  T.nilable(T::Array[Dodopayments::PaymentMethodTypes::OrSymbol]),
18
18
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
@@ -22,6 +22,7 @@ module Dodopayments
22
22
  payment_link: T.nilable(T::Boolean),
23
23
  payment_method_id: T.nilable(String),
24
24
  redirect_immediately: T::Boolean,
25
+ require_phone_number: T::Boolean,
25
26
  return_url: T.nilable(String),
26
27
  short_link: T.nilable(T::Boolean),
27
28
  show_saved_payment_methods: T::Boolean,
@@ -36,6 +37,9 @@ module Dodopayments
36
37
  customer:,
37
38
  # List of products in the cart. Must contain at least 1 and at most 100 items.
38
39
  product_cart:,
40
+ # Whether adaptive currency fees should be included in the price (true) or added
41
+ # on top (false). If not specified, defaults to the business-level setting.
42
+ adaptive_currency_fees_inclusive: nil,
39
43
  # List of payment methods allowed during checkout.
40
44
  #
41
45
  # Customers will **never** see payment methods that are **not** in this list.
@@ -62,6 +66,10 @@ module Dodopayments
62
66
  # If true, redirects the customer immediately after payment completion False by
63
67
  # default
64
68
  redirect_immediately: nil,
69
+ # If true, the customer's phone number is required to create this payment.
70
+ # Typically set alongside `payment_link=true` so merchants can enforce phone
71
+ # collection on the hosted payment page. Defaults to false.
72
+ require_phone_number: nil,
65
73
  # Optional URL to redirect the customer after payment. Must be a valid URL if
66
74
  # provided.
67
75
  return_url: nil,
@@ -28,7 +28,8 @@ module Dodopayments
28
28
  T.nilable(
29
29
  Dodopayments::ProductCreateParams::DigitalProductDelivery::OrHash
30
30
  ),
31
- entitlement_ids: T.nilable(T::Array[String]),
31
+ entitlements:
32
+ T.nilable(T::Array[Dodopayments::AttachProductEntitlement::OrHash]),
32
33
  license_key_activation_message: T.nilable(String),
33
34
  license_key_activations_limit: T.nilable(Integer),
34
35
  license_key_duration:
@@ -54,18 +55,33 @@ module Dodopayments
54
55
  # Optional description of the product
55
56
  description: nil,
56
57
  # Choose how you would like you digital product delivered
58
+ #
59
+ # deprecated: use entitlements instead
57
60
  digital_product_delivery: nil,
58
- # Optional entitlement IDs to attach to this product (max 20)
59
- entitlement_ids: nil,
61
+ # Optional entitlements to attach to this product (max 20)
62
+ entitlements: nil,
60
63
  # Optional message displayed during license key activation
64
+ #
65
+ # deprecated: use entitlements instead. Ignored when a `license_key` entitlement
66
+ # is attached via the `entitlements` field.
61
67
  license_key_activation_message: nil,
62
68
  # The number of times the license key can be activated. Must be 0 or greater
69
+ #
70
+ # deprecated: use entitlements instead. Ignored when a `license_key` entitlement
71
+ # is attached via the `entitlements` field.
63
72
  license_key_activations_limit: nil,
64
73
  # Duration configuration for the license key. Set to null if you don't want the
65
74
  # license key to expire. For subscriptions, the lifetime of the license key is
66
75
  # tied to the subscription period
76
+ #
77
+ # deprecated: use entitlements instead. Ignored when a `license_key` entitlement
78
+ # is attached via the `entitlements` field.
67
79
  license_key_duration: nil,
68
80
  # When true, generates and sends a license key to your customer. Defaults to false
81
+ #
82
+ # deprecated: use entitlements instead. If a `license_key` entitlement is also
83
+ # attached via the `entitlements` field, the `license_key_*` config fields below
84
+ # are ignored — the attached entitlement's config is the source of truth.
69
85
  license_key_enabled: nil,
70
86
  # Additional metadata for the product
71
87
  metadata: nil,
@@ -98,7 +114,8 @@ module Dodopayments
98
114
  T.nilable(
99
115
  Dodopayments::ProductUpdateParams::DigitalProductDelivery::OrHash
100
116
  ),
101
- entitlement_ids: T.nilable(T::Array[String]),
117
+ entitlements:
118
+ T.nilable(T::Array[Dodopayments::AttachProductEntitlement::OrHash]),
102
119
  image_id: T.nilable(String),
103
120
  license_key_activation_message: T.nilable(String),
104
121
  license_key_activations_limit: T.nilable(Integer),
@@ -130,31 +147,41 @@ module Dodopayments
130
147
  # Description of the product, optional and must be at most 1000 characters.
131
148
  description: nil,
132
149
  # Choose how you would like you digital product delivered
150
+ #
151
+ # deprecated: use entitlements instead
133
152
  digital_product_delivery: nil,
134
- # Entitlement IDs to attach (replaces all existing when present) Send empty array
135
- # to remove all, omit field to leave unchanged
136
- entitlement_ids: nil,
153
+ # Entitlements to attach (replaces all existing when present) Send empty array to
154
+ # remove all, omit field to leave unchanged
155
+ entitlements: nil,
137
156
  # Product image id after its uploaded to S3
138
157
  image_id: nil,
139
158
  # Message sent to the customer upon license key activation.
140
159
  #
141
160
  # Only applicable if `license_key_enabled` is `true`. This message contains
142
161
  # instructions for activating the license key.
162
+ #
163
+ # deprecated: use entitlements instead
143
164
  license_key_activation_message: nil,
144
165
  # Limit for the number of activations for the license key.
145
166
  #
146
167
  # Only applicable if `license_key_enabled` is `true`. Represents the maximum
147
168
  # number of times the license key can be activated.
169
+ #
170
+ # deprecated: use entitlements instead
148
171
  license_key_activations_limit: nil,
149
172
  # Duration of the license key if enabled.
150
173
  #
151
174
  # Only applicable if `license_key_enabled` is `true`. Represents the duration in
152
175
  # days for which the license key is valid.
176
+ #
177
+ # deprecated: use entitlements instead
153
178
  license_key_duration: nil,
154
179
  # Whether the product requires a license key.
155
180
  #
156
181
  # If `true`, additional fields related to license key (duration, activations
157
182
  # limit, activation message) become applicable.
183
+ #
184
+ # deprecated: use entitlements instead
158
185
  license_key_enabled: nil,
159
186
  # Additional metadata for the product
160
187
  metadata: nil,
@@ -19,17 +19,15 @@ module Dodopayments
19
19
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
20
20
  discount_code: T.nilable(String),
21
21
  force_3ds: T.nilable(T::Boolean),
22
+ mandate_min_amount_inr_paise: T.nilable(Integer),
22
23
  metadata: T::Hash[Symbol, String],
23
24
  on_demand: T.nilable(Dodopayments::OnDemandSubscription::OrHash),
24
25
  one_time_product_cart:
25
- T.nilable(
26
- T::Array[
27
- Dodopayments::SubscriptionCreateParams::OneTimeProductCart::OrHash
28
- ]
29
- ),
26
+ T.nilable(T::Array[Dodopayments::OneTimeProductCartItem::OrHash]),
30
27
  payment_link: T.nilable(T::Boolean),
31
28
  payment_method_id: T.nilable(String),
32
29
  redirect_immediately: T::Boolean,
30
+ require_phone_number: T::Boolean,
33
31
  return_url: T.nilable(String),
34
32
  short_link: T.nilable(T::Boolean),
35
33
  show_saved_payment_methods: T::Boolean,
@@ -63,6 +61,13 @@ module Dodopayments
63
61
  discount_code: nil,
64
62
  # Override merchant default 3DS behaviour for this subscription
65
63
  force_3ds: nil,
64
+ # Override the merchant-level mandate floor (in INR paise) for INR e-mandates on
65
+ # Indian-card recurring payments. The mandate amount sent to the processor is
66
+ # `max(this_floor, actual_billing_amount)`, so this is effectively the
67
+ # customer-facing authorization ceiling whenever billing is lower. When unset, the
68
+ # merchant setting applies; when that's also unset, the system default of ₹15,000
69
+ # applies.
70
+ mandate_min_amount_inr_paise: nil,
66
71
  # Additional metadata for the subscription Defaults to empty if not specified
67
72
  metadata: nil,
68
73
  on_demand: nil,
@@ -78,6 +83,10 @@ module Dodopayments
78
83
  # If true, redirects the customer immediately after payment completion False by
79
84
  # default
80
85
  redirect_immediately: nil,
86
+ # If true, the customer's phone number is required to create this subscription.
87
+ # Typically set alongside `payment_link=true` so merchants can enforce phone
88
+ # collection on the hosted payment page. Defaults to false.
89
+ require_phone_number: nil,
81
90
  # Optional URL to redirect after successful subscription creation
82
91
  return_url: nil,
83
92
  # If true, returns a shortened payment link. Defaults to false if not specified.
@@ -116,6 +125,9 @@ module Dodopayments
116
125
  T.nilable(
117
126
  Dodopayments::SubscriptionUpdateParams::CancelReason::OrSymbol
118
127
  ),
128
+ cancellation_comment: T.nilable(String),
129
+ cancellation_feedback:
130
+ T.nilable(Dodopayments::CancellationFeedback::OrSymbol),
119
131
  credit_entitlement_cart:
120
132
  T.nilable(
121
133
  T::Array[
@@ -141,6 +153,12 @@ module Dodopayments
141
153
  # When set, the subscription will remain active until the end of billing period
142
154
  cancel_at_next_billing_date: nil,
143
155
  cancel_reason: nil,
156
+ # Free-text cancellation comment (only valid when cancelling or scheduling
157
+ # cancellation).
158
+ cancellation_comment: nil,
159
+ # Customer-supplied churn reason (only valid when cancelling or scheduling
160
+ # cancellation).
161
+ cancellation_feedback: nil,
144
162
  # Update credit entitlement cart settings
145
163
  credit_entitlement_cart: nil,
146
164
  customer_name: nil,
@@ -211,6 +229,7 @@ module Dodopayments
211
229
  proration_billing_mode:
212
230
  Dodopayments::UpdateSubscriptionPlanReq::ProrationBillingMode::OrSymbol,
213
231
  quantity: Integer,
232
+ adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
214
233
  addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
215
234
  discount_code: T.nilable(String),
216
235
  effective_at:
@@ -232,6 +251,9 @@ module Dodopayments
232
251
  proration_billing_mode:,
233
252
  # Number of units to subscribe for. Must be at least 1.
234
253
  quantity:,
254
+ # Whether adaptive currency fees should be included in the price (true) or added
255
+ # on top (false). If not specified, uses the subscription's stored setting.
256
+ adaptive_currency_fees_inclusive: nil,
235
257
  # Addons for the new plan. Note : Leaving this empty would remove any existing
236
258
  # addons
237
259
  addons: nil,
@@ -307,6 +329,7 @@ module Dodopayments
307
329
  proration_billing_mode:
308
330
  Dodopayments::UpdateSubscriptionPlanReq::ProrationBillingMode::OrSymbol,
309
331
  quantity: Integer,
332
+ adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
310
333
  addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
311
334
  discount_code: T.nilable(String),
312
335
  effective_at:
@@ -328,6 +351,9 @@ module Dodopayments
328
351
  proration_billing_mode:,
329
352
  # Number of units to subscribe for. Must be at least 1.
330
353
  quantity:,
354
+ # Whether adaptive currency fees should be included in the price (true) or added
355
+ # on top (false). If not specified, uses the subscription's stored setting.
356
+ adaptive_currency_fees_inclusive: nil,
331
357
  # Addons for the new plan. Note : Leaving this empty would remove any existing
332
358
  # addons
333
359
  addons: nil,
@@ -139,6 +139,7 @@ module Dodopayments
139
139
  Dodopayments::CreditExpiredWebhookEvent,
140
140
  Dodopayments::CreditManualAdjustmentWebhookEvent,
141
141
  Dodopayments::CreditOverageChargedWebhookEvent,
142
+ Dodopayments::CreditOverageResetWebhookEvent,
142
143
  Dodopayments::CreditRolledOverWebhookEvent,
143
144
  Dodopayments::CreditRolloverForfeitedWebhookEvent,
144
145
  Dodopayments::DisputeAcceptedWebhookEvent,
@@ -150,6 +151,10 @@ module Dodopayments
150
151
  Dodopayments::DisputeWonWebhookEvent,
151
152
  Dodopayments::DunningRecoveredWebhookEvent,
152
153
  Dodopayments::DunningStartedWebhookEvent,
154
+ Dodopayments::EntitlementGrantCreatedWebhookEvent,
155
+ Dodopayments::EntitlementGrantDeliveredWebhookEvent,
156
+ Dodopayments::EntitlementGrantFailedWebhookEvent,
157
+ Dodopayments::EntitlementGrantRevokedWebhookEvent,
153
158
  Dodopayments::LicenseKeyCreatedWebhookEvent,
154
159
  Dodopayments::PaymentCancelledWebhookEvent,
155
160
  Dodopayments::PaymentFailedWebhookEvent,
@@ -189,6 +194,7 @@ module Dodopayments
189
194
  Dodopayments::CreditExpiredWebhookEvent,
190
195
  Dodopayments::CreditManualAdjustmentWebhookEvent,
191
196
  Dodopayments::CreditOverageChargedWebhookEvent,
197
+ Dodopayments::CreditOverageResetWebhookEvent,
192
198
  Dodopayments::CreditRolledOverWebhookEvent,
193
199
  Dodopayments::CreditRolloverForfeitedWebhookEvent,
194
200
  Dodopayments::DisputeAcceptedWebhookEvent,
@@ -200,6 +206,10 @@ module Dodopayments
200
206
  Dodopayments::DisputeWonWebhookEvent,
201
207
  Dodopayments::DunningRecoveredWebhookEvent,
202
208
  Dodopayments::DunningStartedWebhookEvent,
209
+ Dodopayments::EntitlementGrantCreatedWebhookEvent,
210
+ Dodopayments::EntitlementGrantDeliveredWebhookEvent,
211
+ Dodopayments::EntitlementGrantFailedWebhookEvent,
212
+ Dodopayments::EntitlementGrantRevokedWebhookEvent,
203
213
  Dodopayments::LicenseKeyCreatedWebhookEvent,
204
214
  Dodopayments::PaymentCancelledWebhookEvent,
205
215
  Dodopayments::PaymentFailedWebhookEvent,
@@ -61,6 +61,8 @@ module Dodopayments
61
61
 
62
62
  attr_reader credit_entitlements: Dodopayments::Resources::CreditEntitlements
63
63
 
64
+ attr_reader entitlements: Dodopayments::Resources::Entitlements
65
+
64
66
  private def auth_headers: -> ::Hash[String, String]
65
67
 
66
68
  def initialize: (
@@ -0,0 +1,13 @@
1
+ module Dodopayments
2
+ module Models
3
+ type attach_product_entitlement = { entitlement_id: String }
4
+
5
+ class AttachProductEntitlement < Dodopayments::Internal::Type::BaseModel
6
+ attr_accessor entitlement_id: String
7
+
8
+ def initialize: (entitlement_id: String) -> void
9
+
10
+ def to_hash: -> { entitlement_id: String }
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ module Dodopayments
2
+ module Models
3
+ type cancellation_feedback =
4
+ :too_expensive
5
+ | :missing_features
6
+ | :switched_service
7
+ | :unused
8
+ | :customer_service
9
+ | :low_quality
10
+ | :too_complex
11
+ | :other
12
+
13
+ module CancellationFeedback
14
+ extend Dodopayments::Internal::Type::Enum
15
+
16
+ TOO_EXPENSIVE: :too_expensive
17
+ MISSING_FEATURES: :missing_features
18
+ SWITCHED_SERVICE: :switched_service
19
+ UNUSED: :unused
20
+ CUSTOMER_SERVICE: :customer_service
21
+ LOW_QUALITY: :low_quality
22
+ TOO_COMPLEX: :too_complex
23
+ OTHER: :other
24
+
25
+ def self?.values: -> ::Array[Dodopayments::Models::cancellation_feedback]
26
+ end
27
+ end
28
+ end