dodopayments 2.20.0 → 2.21.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 (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/models/checkout_session_preview_response.rb +41 -4
  5. data/lib/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rb +4 -2
  6. data/lib/dodopayments/models/discount.rb +95 -3
  7. data/lib/dodopayments/models/discount_create_params.rb +110 -3
  8. data/lib/dodopayments/models/discount_list_params.rb +7 -2
  9. data/lib/dodopayments/models/discount_type.rb +1 -0
  10. data/lib/dodopayments/models/discount_update_params.rb +108 -3
  11. data/lib/dodopayments/models/payment.rb +162 -1
  12. data/lib/dodopayments/models/payment_list_params.rb +163 -1
  13. data/lib/dodopayments/models/payment_method_types.rb +0 -1
  14. data/lib/dodopayments/models/price.rb +19 -1
  15. data/lib/dodopayments/models/subscription.rb +11 -1
  16. data/lib/dodopayments/models/subscription_create_response.rb +10 -1
  17. data/lib/dodopayments/models/subscription_list_params.rb +12 -1
  18. data/lib/dodopayments/models/subscription_list_response.rb +11 -1
  19. data/lib/dodopayments/models/subscription_update_payment_method_webhook_event.rb +40 -0
  20. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +4 -1
  21. data/lib/dodopayments/models/unwrap_webhook_event.rb +4 -1
  22. data/lib/dodopayments/models/webhook_event_type.rb +1 -0
  23. data/lib/dodopayments/models.rb +3 -0
  24. data/lib/dodopayments/resources/credit_entitlements/balances.rb +1 -1
  25. data/lib/dodopayments/resources/discounts.rb +24 -5
  26. data/lib/dodopayments/resources/payments.rb +3 -1
  27. data/lib/dodopayments/resources/subscriptions.rb +6 -1
  28. data/lib/dodopayments/resources/webhooks.rb +2 -2
  29. data/lib/dodopayments/version.rb +1 -1
  30. data/lib/dodopayments.rb +1 -0
  31. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +47 -5
  32. data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rbi +6 -2
  33. data/rbi/dodopayments/models/discount.rbi +151 -2
  34. data/rbi/dodopayments/models/discount_create_params.rbi +197 -2
  35. data/rbi/dodopayments/models/discount_list_params.rbi +6 -2
  36. data/rbi/dodopayments/models/discount_type.rbi +1 -0
  37. data/rbi/dodopayments/models/discount_update_params.rbi +193 -2
  38. data/rbi/dodopayments/models/payment.rbi +365 -0
  39. data/rbi/dodopayments/models/payment_list_params.rbi +327 -0
  40. data/rbi/dodopayments/models/payment_method_types.rbi +0 -1
  41. data/rbi/dodopayments/models/price.rbi +20 -0
  42. data/rbi/dodopayments/models/subscription.rbi +15 -3
  43. data/rbi/dodopayments/models/subscription_create_response.rbi +13 -3
  44. data/rbi/dodopayments/models/subscription_list_params.rbi +11 -0
  45. data/rbi/dodopayments/models/subscription_list_response.rbi +15 -3
  46. data/rbi/dodopayments/models/subscription_update_payment_method_webhook_event.rbi +67 -0
  47. data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +1 -0
  48. data/rbi/dodopayments/models/unwrap_webhook_event.rbi +1 -0
  49. data/rbi/dodopayments/models/webhook_event_type.rbi +5 -0
  50. data/rbi/dodopayments/models.rbi +3 -0
  51. data/rbi/dodopayments/resources/credit_entitlements/balances.rbi +3 -1
  52. data/rbi/dodopayments/resources/discounts.rbi +57 -3
  53. data/rbi/dodopayments/resources/payments.rbi +3 -0
  54. data/rbi/dodopayments/resources/subscriptions.rbi +3 -0
  55. data/rbi/dodopayments/resources/webhooks.rbi +2 -0
  56. data/sig/dodopayments/models/checkout_session_preview_response.rbs +18 -3
  57. data/sig/dodopayments/models/discount.rbs +69 -0
  58. data/sig/dodopayments/models/discount_create_params.rbs +69 -0
  59. data/sig/dodopayments/models/discount_type.rbs +2 -1
  60. data/sig/dodopayments/models/discount_update_params.rbs +69 -0
  61. data/sig/dodopayments/models/payment.rbs +145 -0
  62. data/sig/dodopayments/models/payment_list_params.rbs +308 -0
  63. data/sig/dodopayments/models/payment_method_types.rbs +0 -2
  64. data/sig/dodopayments/models/price.rbs +10 -0
  65. data/sig/dodopayments/models/subscription.rbs +8 -3
  66. data/sig/dodopayments/models/subscription_create_response.rbs +8 -3
  67. data/sig/dodopayments/models/subscription_list_params.rbs +7 -0
  68. data/sig/dodopayments/models/subscription_list_response.rbs +8 -3
  69. data/sig/dodopayments/models/subscription_update_payment_method_webhook_event.rbs +35 -0
  70. data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +1 -0
  71. data/sig/dodopayments/models/unwrap_webhook_event.rbs +1 -0
  72. data/sig/dodopayments/models/webhook_event_type.rbs +2 -0
  73. data/sig/dodopayments/models.rbs +2 -0
  74. data/sig/dodopayments/resources/discounts.rbs +8 -0
  75. data/sig/dodopayments/resources/payments.rbs +1 -0
  76. data/sig/dodopayments/resources/subscriptions.rbs +1 -0
  77. data/sig/dodopayments/resources/webhooks.rbs +2 -0
  78. metadata +5 -2
@@ -27,6 +27,27 @@ module Dodopayments
27
27
  # @return [String, nil]
28
28
  optional :code, String, nil?: true
29
29
 
30
+ # @!attribute currency_options
31
+ # If present, fully replaces the discount's currency options (replace-set
32
+ # semantics, like `restricted_to`). Send an empty array to clear them.
33
+ #
34
+ # @return [Array<Dodopayments::Models::DiscountUpdateParams::CurrencyOption>, nil]
35
+ optional :currency_options,
36
+ -> {
37
+ Dodopayments::Internal::Type::ArrayOf[Dodopayments::DiscountUpdateParams::CurrencyOption]
38
+ },
39
+ nil?: true
40
+
41
+ # @!attribute customer_eligibility
42
+ # If present, update who may redeem this discount. Plain field (not
43
+ # double-option): the DB column is `NOT NULL`, so it can never be cleared back to
44
+ # unset, only changed to another `CustomerEligibility` value.
45
+ #
46
+ # @return [Symbol, Dodopayments::Models::DiscountUpdateParams::CustomerEligibility, nil]
47
+ optional :customer_eligibility,
48
+ enum: -> { Dodopayments::DiscountUpdateParams::CustomerEligibility },
49
+ nil?: true
50
+
30
51
  # @!attribute expires_at
31
52
  #
32
53
  # @return [Time, nil]
@@ -45,6 +66,14 @@ module Dodopayments
45
66
  # @return [String, nil]
46
67
  optional :name, String, nil?: true
47
68
 
69
+ # @!attribute per_customer_usage_limit
70
+ # If present, update the per-customer usage limit (double-option: send `null` to
71
+ # clear it back to unlimited). Must be `<= usage_limit` (the value in effect after
72
+ # this patch) when both are set.
73
+ #
74
+ # @return [Integer, nil]
75
+ optional :per_customer_usage_limit, Integer, nil?: true
76
+
48
77
  # @!attribute preserve_on_plan_change
49
78
  # Whether this discount should be preserved when a subscription changes plans. If
50
79
  # not provided, the existing value is kept.
@@ -59,6 +88,12 @@ module Dodopayments
59
88
  # @return [Array<String>, nil]
60
89
  optional :restricted_to, Dodopayments::Internal::Type::ArrayOf[String], nil?: true
61
90
 
91
+ # @!attribute starts_at
92
+ # If present, update `starts_at` (double-option: send `null` to clear it).
93
+ #
94
+ # @return [Time, nil]
95
+ optional :starts_at, Time, nil?: true
96
+
62
97
  # @!attribute subscription_cycles
63
98
  # Number of subscription billing cycles this discount is valid for. If not
64
99
  # provided, the discount will be applied indefinitely to all recurring payments
@@ -68,7 +103,7 @@ module Dodopayments
68
103
  optional :subscription_cycles, Integer, nil?: true
69
104
 
70
105
  # @!attribute type
71
- # If present, update the discount type. Currently only `percentage` is supported.
106
+ # If present, update the discount type (`percentage` or `flat`).
72
107
  #
73
108
  # @return [Symbol, Dodopayments::Models::DiscountType, nil]
74
109
  optional :type, enum: -> { Dodopayments::DiscountType }, nil?: true
@@ -78,7 +113,7 @@ module Dodopayments
78
113
  # @return [Integer, nil]
79
114
  optional :usage_limit, Integer, nil?: true
80
115
 
81
- # @!method initialize(discount_id:, amount: nil, code: nil, expires_at: nil, metadata: nil, name: nil, preserve_on_plan_change: nil, restricted_to: nil, subscription_cycles: nil, type: nil, usage_limit: nil, request_options: {})
116
+ # @!method initialize(discount_id:, amount: nil, code: nil, currency_options: nil, customer_eligibility: nil, expires_at: nil, metadata: nil, name: nil, per_customer_usage_limit: nil, preserve_on_plan_change: nil, restricted_to: nil, starts_at: nil, subscription_cycles: nil, type: nil, usage_limit: nil, request_options: {})
82
117
  # Some parameter documentations has been truncated, see
83
118
  # {Dodopayments::Models::DiscountUpdateParams} for more details.
84
119
  #
@@ -88,23 +123,93 @@ module Dodopayments
88
123
  #
89
124
  # @param code [String, nil] If present, update the discount code (uppercase).
90
125
  #
126
+ # @param currency_options [Array<Dodopayments::Models::DiscountUpdateParams::CurrencyOption>, nil] If present, fully replaces the discount's currency options (replace-set
127
+ #
128
+ # @param customer_eligibility [Symbol, Dodopayments::Models::DiscountUpdateParams::CustomerEligibility, nil] If present, update who may redeem this discount. Plain field (not
129
+ #
91
130
  # @param expires_at [Time, nil]
92
131
  #
93
132
  # @param metadata [Hash{Symbol=>String, Float, Boolean}, nil] Additional metadata for the discount
94
133
  #
95
134
  # @param name [String, nil]
96
135
  #
136
+ # @param per_customer_usage_limit [Integer, nil] If present, update the per-customer usage limit (double-option: send
137
+ #
97
138
  # @param preserve_on_plan_change [Boolean, nil] Whether this discount should be preserved when a subscription changes plans.
98
139
  #
99
140
  # @param restricted_to [Array<String>, nil] If present, replaces all restricted product IDs with this new set.
100
141
  #
142
+ # @param starts_at [Time, nil] If present, update `starts_at` (double-option: send `null` to clear it).
143
+ #
101
144
  # @param subscription_cycles [Integer, nil] Number of subscription billing cycles this discount is valid for.
102
145
  #
103
- # @param type [Symbol, Dodopayments::Models::DiscountType, nil] If present, update the discount type. Currently only `percentage` is supported.
146
+ # @param type [Symbol, Dodopayments::Models::DiscountType, nil] If present, update the discount type (`percentage` or `flat`).
104
147
  #
105
148
  # @param usage_limit [Integer, nil]
106
149
  #
107
150
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
151
+
152
+ class CurrencyOption < Dodopayments::Internal::Type::BaseModel
153
+ # @!attribute currency
154
+ # The currency this option applies to.
155
+ #
156
+ # @return [Symbol, Dodopayments::Models::Currency]
157
+ required :currency, enum: -> { Dodopayments::Currency }
158
+
159
+ # @!attribute is_default
160
+ # Whether this row is the default to convert from for unconfigured currencies. At
161
+ # most one row per discount may be default.
162
+ #
163
+ # @return [Boolean, nil]
164
+ optional :is_default, Dodopayments::Internal::Type::Boolean
165
+
166
+ # @!attribute max_amount_possible
167
+ # The most this code discounts in this currency's subunits. For `flat` codes this
168
+ # is the deduction; for `percentage` codes it is the max-discount cap. Must be > 0
169
+ # if provided.
170
+ #
171
+ # @return [Integer, nil]
172
+ optional :max_amount_possible, Integer, nil?: true
173
+
174
+ # @!attribute minimum_subtotal
175
+ # Eligible-cart threshold in this currency's subunits (0 = no minimum).
176
+ #
177
+ # @return [Integer, nil]
178
+ optional :minimum_subtotal, Integer
179
+
180
+ # @!method initialize(currency:, is_default: nil, max_amount_possible: nil, minimum_subtotal: nil)
181
+ # Some parameter documentations has been truncated, see
182
+ # {Dodopayments::Models::DiscountUpdateParams::CurrencyOption} for more details.
183
+ #
184
+ # A per-currency discount option (request shape).
185
+ #
186
+ # `max_amount_possible` is the most this code discounts in this currency — the
187
+ # flat deduction for `flat` codes, or the max-discount cap for `percentage` codes.
188
+ # Maps to the DB column of the same name.
189
+ #
190
+ # @param currency [Symbol, Dodopayments::Models::Currency] The currency this option applies to.
191
+ #
192
+ # @param is_default [Boolean] Whether this row is the default to convert from for unconfigured
193
+ #
194
+ # @param max_amount_possible [Integer, nil] The most this code discounts in this currency's subunits. For `flat` codes
195
+ #
196
+ # @param minimum_subtotal [Integer] Eligible-cart threshold in this currency's subunits (0 = no minimum).
197
+ end
198
+
199
+ # If present, update who may redeem this discount. Plain field (not
200
+ # double-option): the DB column is `NOT NULL`, so it can never be cleared back to
201
+ # unset, only changed to another `CustomerEligibility` value.
202
+ module CustomerEligibility
203
+ extend Dodopayments::Internal::Type::Enum
204
+
205
+ ANY = :any
206
+ FIRST_TIME = :first_time
207
+ EXISTING = :existing
208
+ SPECIFIC = :specific
209
+
210
+ # @!method self.values
211
+ # @return [Array<Symbol>]
212
+ end
108
213
  end
109
214
  end
110
215
  end
@@ -52,6 +52,13 @@ module Dodopayments
52
52
  # @return [Array<Dodopayments::Models::Dispute>]
53
53
  required :disputes, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Dispute] }
54
54
 
55
+ # @!attribute is_update_payment_method
56
+ # Whether this payment was created solely to update a subscription's payment
57
+ # method (a zero-/setup-amount charge). `false` for normal charges.
58
+ #
59
+ # @return [Boolean]
60
+ required :is_update_payment_method, Dodopayments::Internal::Type::Boolean
61
+
55
62
  # @!attribute metadata
56
63
  # Additional custom data associated with the payment
57
64
  #
@@ -182,6 +189,16 @@ module Dodopayments
182
189
  # @return [String, nil]
183
190
  optional :error_message, String, nil?: true
184
191
 
192
+ # @!attribute failure_details
193
+ # Purpose-built failure messaging for the merchant and the customer, derived from
194
+ # `error_code`. Present whenever `error_code` is set, regardless of payment
195
+ # status; unrecognised codes still resolve via a generic fallback rather than
196
+ # being omitted. The customer copy is always generic for fraud-sensitive declines
197
+ # (lost/stolen/pickup/fraudulent) so the true reason is never leaked.
198
+ #
199
+ # @return [Dodopayments::Models::Payment::FailureDetails, nil]
200
+ optional :failure_details, -> { Dodopayments::Payment::FailureDetails }, nil?: true
201
+
185
202
  # @!attribute invoice_id
186
203
  # Invoice ID for this payment. Uses India-specific invoice ID if available.
187
204
  #
@@ -206,6 +223,12 @@ module Dodopayments
206
223
  # @return [String, nil]
207
224
  optional :payment_method, String, nil?: true
208
225
 
226
+ # @!attribute payment_method_id
227
+ # Identifier of the saved payment method used for this payment, if any.
228
+ #
229
+ # @return [String, nil]
230
+ optional :payment_method_id, String, nil?: true
231
+
209
232
  # @!attribute payment_method_type
210
233
  # Specific type of payment method (e.g. "visa", "mastercard")
211
234
  #
@@ -260,7 +283,7 @@ module Dodopayments
260
283
  # @return [Time, nil]
261
284
  optional :updated_at, Time, nil?: true
262
285
 
263
- # @!method initialize(billing:, brand_id:, business_id:, created_at:, currency:, customer:, digital_products_delivered:, disputes:, metadata:, payment_id:, payment_provider:, refunds:, retry_attempt:, settlement_amount:, settlement_currency:, total_amount:, card_holder_name: nil, card_issuing_country: nil, card_last_four: nil, card_network: nil, card_type: nil, checkout_session_id: nil, custom_field_responses: nil, discount_id: nil, discounts: nil, error_code: nil, error_message: nil, invoice_id: nil, invoice_url: nil, payment_link: nil, payment_method: nil, payment_method_type: nil, product_cart: nil, refund_status: nil, settlement_tax: nil, status: nil, subscription_id: nil, tax: nil, updated_at: nil)
286
+ # @!method initialize(billing:, brand_id:, business_id:, created_at:, currency:, customer:, digital_products_delivered:, disputes:, is_update_payment_method:, metadata:, payment_id:, payment_provider:, refunds:, retry_attempt:, settlement_amount:, settlement_currency:, total_amount:, card_holder_name: nil, card_issuing_country: nil, card_last_four: nil, card_network: nil, card_type: nil, checkout_session_id: nil, custom_field_responses: nil, discount_id: nil, discounts: nil, error_code: nil, error_message: nil, failure_details: nil, invoice_id: nil, invoice_url: nil, payment_link: nil, payment_method: nil, payment_method_id: nil, payment_method_type: nil, product_cart: nil, refund_status: nil, settlement_tax: nil, status: nil, subscription_id: nil, tax: nil, updated_at: nil)
264
287
  # Some parameter documentations has been truncated, see
265
288
  # {Dodopayments::Models::Payment} for more details.
266
289
  #
@@ -280,6 +303,8 @@ module Dodopayments
280
303
  #
281
304
  # @param disputes [Array<Dodopayments::Models::Dispute>] List of disputes associated with this payment
282
305
  #
306
+ # @param is_update_payment_method [Boolean] Whether this payment was created solely to update a subscription's
307
+ #
283
308
  # @param metadata [Hash{Symbol=>String, Float, Boolean}] Additional custom data associated with the payment
284
309
  #
285
310
  # @param payment_id [String] Unique identifier for the payment
@@ -318,6 +343,8 @@ module Dodopayments
318
343
  #
319
344
  # @param error_message [String, nil] An error message if the payment failed
320
345
  #
346
+ # @param failure_details [Dodopayments::Models::Payment::FailureDetails, nil] Purpose-built failure messaging for the merchant and the customer, derived
347
+ #
321
348
  # @param invoice_id [String, nil] Invoice ID for this payment. Uses India-specific invoice ID if available.
322
349
  #
323
350
  # @param invoice_url [String, nil] URL to download the invoice PDF for this payment.
@@ -326,6 +353,8 @@ module Dodopayments
326
353
  #
327
354
  # @param payment_method [String, nil] Payment method used by customer (e.g. "card", "bank_transfer")
328
355
  #
356
+ # @param payment_method_id [String, nil] Identifier of the saved payment method used for this payment, if any.
357
+ #
329
358
  # @param payment_method_type [String, nil] Specific type of payment method (e.g. "visa", "mastercard")
330
359
  #
331
360
  # @param product_cart [Array<Dodopayments::Models::Payment::ProductCart>, nil] List of products purchased in a one-time payment
@@ -357,6 +386,138 @@ module Dodopayments
357
386
  # @return [Array<Symbol>]
358
387
  end
359
388
 
389
+ # @see Dodopayments::Models::Payment#failure_details
390
+ class FailureDetails < Dodopayments::Internal::Type::BaseModel
391
+ # @!attribute code
392
+ # The unified error code (echoes `error_code`).
393
+ #
394
+ # @return [String]
395
+ required :code, String
396
+
397
+ # @!attribute customer_cta
398
+ # The primary CTA to show the customer.
399
+ #
400
+ # @return [Symbol, Dodopayments::Models::Payment::FailureDetails::CustomerCta]
401
+ required :customer_cta, enum: -> { Dodopayments::Payment::FailureDetails::CustomerCta }
402
+
403
+ # @!attribute customer_fixable
404
+ # Whether the customer can resolve this themselves (e.g. fix CVC).
405
+ #
406
+ # @return [Boolean]
407
+ required :customer_fixable, Dodopayments::Internal::Type::Boolean
408
+
409
+ # @!attribute customer_message
410
+ # The customer-facing string. Always generic (`C11`) for the fraud-4.
411
+ #
412
+ # @return [String]
413
+ required :customer_message, String
414
+
415
+ # @!attribute customer_template
416
+ # The customer message template identifier (C1..C20).
417
+ #
418
+ # @return [Symbol, Dodopayments::Models::Payment::FailureDetails::CustomerTemplate]
419
+ required :customer_template, enum: -> { Dodopayments::Payment::FailureDetails::CustomerTemplate }
420
+
421
+ # @!attribute decline_type
422
+ # Soft or hard decline.
423
+ #
424
+ # @return [Symbol, Dodopayments::Models::Payment::FailureDetails::DeclineType]
425
+ required :decline_type, enum: -> { Dodopayments::Payment::FailureDetails::DeclineType }
426
+
427
+ # @!attribute merchant_message
428
+ # Merchant-facing headline + recommended action (Payment Details). For the fraud-4
429
+ # this includes the operator "do not reveal" warning.
430
+ #
431
+ # @return [String]
432
+ required :merchant_message, String
433
+
434
+ # @!method initialize(code:, customer_cta:, customer_fixable:, customer_message:, customer_template:, decline_type:, merchant_message:)
435
+ # Some parameter documentations has been truncated, see
436
+ # {Dodopayments::Models::Payment::FailureDetails} for more details.
437
+ #
438
+ # Purpose-built failure messaging for the merchant and the customer, derived from
439
+ # `error_code`. Present whenever `error_code` is set, regardless of payment
440
+ # status; unrecognised codes still resolve via a generic fallback rather than
441
+ # being omitted. The customer copy is always generic for fraud-sensitive declines
442
+ # (lost/stolen/pickup/fraudulent) so the true reason is never leaked.
443
+ #
444
+ # @param code [String] The unified error code (echoes `error_code`).
445
+ #
446
+ # @param customer_cta [Symbol, Dodopayments::Models::Payment::FailureDetails::CustomerCta] The primary CTA to show the customer.
447
+ #
448
+ # @param customer_fixable [Boolean] Whether the customer can resolve this themselves (e.g. fix CVC).
449
+ #
450
+ # @param customer_message [String] The customer-facing string. Always generic (`C11`) for the fraud-4.
451
+ #
452
+ # @param customer_template [Symbol, Dodopayments::Models::Payment::FailureDetails::CustomerTemplate] The customer message template identifier (C1..C20).
453
+ #
454
+ # @param decline_type [Symbol, Dodopayments::Models::Payment::FailureDetails::DeclineType] Soft or hard decline.
455
+ #
456
+ # @param merchant_message [String] Merchant-facing headline + recommended action (Payment Details). For the fraud-4
457
+
458
+ # The primary CTA to show the customer.
459
+ #
460
+ # @see Dodopayments::Models::Payment::FailureDetails#customer_cta
461
+ module CustomerCta
462
+ extend Dodopayments::Internal::Type::Enum
463
+
464
+ EDIT_AND_RETRY = :edit_and_retry
465
+ USE_ANOTHER_METHOD = :use_another_method
466
+ TRY_AGAIN = :try_again
467
+ TRY_LATER = :try_later
468
+ RETRY_AND_VERIFY = :retry_and_verify
469
+ RESTART = :restart
470
+ UPDATE_METHOD = :update_method
471
+
472
+ # @!method self.values
473
+ # @return [Array<Symbol>]
474
+ end
475
+
476
+ # The customer message template identifier (C1..C20).
477
+ #
478
+ # @see Dodopayments::Models::Payment::FailureDetails#customer_template
479
+ module CustomerTemplate
480
+ extend Dodopayments::Internal::Type::Enum
481
+
482
+ C1 = :C1
483
+ C2 = :C2
484
+ C3 = :C3
485
+ C4 = :C4
486
+ C5 = :C5
487
+ C6 = :C6
488
+ C7 = :C7
489
+ C8 = :C8
490
+ C9 = :C9
491
+ C10 = :C10
492
+ C11 = :C11
493
+ C12 = :C12
494
+ C13 = :C13
495
+ C14 = :C14
496
+ C15 = :C15
497
+ C16 = :C16
498
+ C17 = :C17
499
+ C18 = :C18
500
+ C19 = :C19
501
+ C20 = :C20
502
+
503
+ # @!method self.values
504
+ # @return [Array<Symbol>]
505
+ end
506
+
507
+ # Soft or hard decline.
508
+ #
509
+ # @see Dodopayments::Models::Payment::FailureDetails#decline_type
510
+ module DeclineType
511
+ extend Dodopayments::Internal::Type::Enum
512
+
513
+ SOFT = :soft
514
+ HARD = :hard
515
+
516
+ # @!method self.values
517
+ # @return [Array<Symbol>]
518
+ end
519
+ end
520
+
360
521
  class ProductCart < Dodopayments::Internal::Type::BaseModel
361
522
  # @!attribute product_id
362
523
  #
@@ -25,6 +25,12 @@ module Dodopayments
25
25
  # @return [Time, nil]
26
26
  optional :created_at_lte, Time
27
27
 
28
+ # @!attribute currency
29
+ # Filter by currency
30
+ #
31
+ # @return [Symbol, Dodopayments::Models::PaymentListParams::Currency, nil]
32
+ optional :currency, enum: -> { Dodopayments::PaymentListParams::Currency }
33
+
28
34
  # @!attribute customer_id
29
35
  # Filter by customer id
30
36
  #
@@ -61,13 +67,15 @@ module Dodopayments
61
67
  # @return [String, nil]
62
68
  optional :subscription_id, String
63
69
 
64
- # @!method initialize(brand_id: nil, created_at_gte: nil, created_at_lte: nil, customer_id: nil, page_number: nil, page_size: nil, product_id: nil, status: nil, subscription_id: nil, request_options: {})
70
+ # @!method initialize(brand_id: nil, created_at_gte: nil, created_at_lte: nil, currency: nil, customer_id: nil, page_number: nil, page_size: nil, product_id: nil, status: nil, subscription_id: nil, request_options: {})
65
71
  # @param brand_id [String] filter by Brand id
66
72
  #
67
73
  # @param created_at_gte [Time] Get events after this created time
68
74
  #
69
75
  # @param created_at_lte [Time] Get events created before this time
70
76
  #
77
+ # @param currency [Symbol, Dodopayments::Models::PaymentListParams::Currency] Filter by currency
78
+ #
71
79
  # @param customer_id [String] Filter by customer id
72
80
  #
73
81
  # @param page_number [Integer] Page number default is 0
@@ -82,6 +90,160 @@ module Dodopayments
82
90
  #
83
91
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
84
92
 
93
+ # Filter by currency
94
+ module Currency
95
+ extend Dodopayments::Internal::Type::Enum
96
+
97
+ AED = :AED
98
+ ALL = :ALL
99
+ AMD = :AMD
100
+ ANG = :ANG
101
+ AOA = :AOA
102
+ ARS = :ARS
103
+ AUD = :AUD
104
+ AWG = :AWG
105
+ AZN = :AZN
106
+ BAM = :BAM
107
+ BBD = :BBD
108
+ BDT = :BDT
109
+ BGN = :BGN
110
+ BHD = :BHD
111
+ BIF = :BIF
112
+ BMD = :BMD
113
+ BND = :BND
114
+ BOB = :BOB
115
+ BRL = :BRL
116
+ BSD = :BSD
117
+ BWP = :BWP
118
+ BYN = :BYN
119
+ BZD = :BZD
120
+ CAD = :CAD
121
+ CHF = :CHF
122
+ CLP = :CLP
123
+ CNY = :CNY
124
+ COP = :COP
125
+ CRC = :CRC
126
+ CUP = :CUP
127
+ CVE = :CVE
128
+ CZK = :CZK
129
+ DJF = :DJF
130
+ DKK = :DKK
131
+ DOP = :DOP
132
+ DZD = :DZD
133
+ EGP = :EGP
134
+ ETB = :ETB
135
+ EUR = :EUR
136
+ FJD = :FJD
137
+ FKP = :FKP
138
+ GBP = :GBP
139
+ GEL = :GEL
140
+ GHS = :GHS
141
+ GIP = :GIP
142
+ GMD = :GMD
143
+ GNF = :GNF
144
+ GTQ = :GTQ
145
+ GYD = :GYD
146
+ HKD = :HKD
147
+ HNL = :HNL
148
+ HRK = :HRK
149
+ HTG = :HTG
150
+ HUF = :HUF
151
+ IDR = :IDR
152
+ ILS = :ILS
153
+ INR = :INR
154
+ IQD = :IQD
155
+ JMD = :JMD
156
+ JOD = :JOD
157
+ JPY = :JPY
158
+ KES = :KES
159
+ KGS = :KGS
160
+ KHR = :KHR
161
+ KMF = :KMF
162
+ KRW = :KRW
163
+ KWD = :KWD
164
+ KYD = :KYD
165
+ KZT = :KZT
166
+ LAK = :LAK
167
+ LBP = :LBP
168
+ LKR = :LKR
169
+ LRD = :LRD
170
+ LSL = :LSL
171
+ LYD = :LYD
172
+ MAD = :MAD
173
+ MDL = :MDL
174
+ MGA = :MGA
175
+ MKD = :MKD
176
+ MMK = :MMK
177
+ MNT = :MNT
178
+ MOP = :MOP
179
+ MRU = :MRU
180
+ MUR = :MUR
181
+ MVR = :MVR
182
+ MWK = :MWK
183
+ MXN = :MXN
184
+ MYR = :MYR
185
+ MZN = :MZN
186
+ NAD = :NAD
187
+ NGN = :NGN
188
+ NIO = :NIO
189
+ NOK = :NOK
190
+ NPR = :NPR
191
+ NZD = :NZD
192
+ OMR = :OMR
193
+ PAB = :PAB
194
+ PEN = :PEN
195
+ PGK = :PGK
196
+ PHP = :PHP
197
+ PKR = :PKR
198
+ PLN = :PLN
199
+ PYG = :PYG
200
+ QAR = :QAR
201
+ RON = :RON
202
+ RSD = :RSD
203
+ RUB = :RUB
204
+ RWF = :RWF
205
+ SAR = :SAR
206
+ SBD = :SBD
207
+ SCR = :SCR
208
+ SEK = :SEK
209
+ SGD = :SGD
210
+ SHP = :SHP
211
+ SLE = :SLE
212
+ SLL = :SLL
213
+ SOS = :SOS
214
+ SRD = :SRD
215
+ SSP = :SSP
216
+ STN = :STN
217
+ SVC = :SVC
218
+ SZL = :SZL
219
+ THB = :THB
220
+ TND = :TND
221
+ TOP = :TOP
222
+ TRY = :TRY
223
+ TTD = :TTD
224
+ TWD = :TWD
225
+ TZS = :TZS
226
+ UAH = :UAH
227
+ UGX = :UGX
228
+ USD = :USD
229
+ UYU = :UYU
230
+ UZS = :UZS
231
+ VES = :VES
232
+ VND = :VND
233
+ VUV = :VUV
234
+ WST = :WST
235
+ XAF = :XAF
236
+ XCD = :XCD
237
+ XOF = :XOF
238
+ XPF = :XPF
239
+ YER = :YER
240
+ ZAR = :ZAR
241
+ ZMW = :ZMW
242
+
243
+ # @!method self.values
244
+ # @return [Array<Symbol>]
245
+ end
246
+
85
247
  # Filter by status
86
248
  module Status
87
249
  extend Dodopayments::Internal::Type::Enum
@@ -85,7 +85,6 @@ module Dodopayments
85
85
  SEPA = :sepa
86
86
  SEPA_BANK_TRANSFER = :sepa_bank_transfer
87
87
  SOFORT = :sofort
88
- SUNBIT = :sunbit
89
88
  SWISH = :swish
90
89
  TOUCH_N_GO = :touch_n_go
91
90
  TRUSTLY = :trustly
@@ -160,13 +160,27 @@ module Dodopayments
160
160
  # @return [Boolean, nil]
161
161
  optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
162
162
 
163
+ # @!attribute trial_amount
164
+ # Amount charged today for a paid trial, in the price currency's minor units.
165
+ # Requires `trial_period_days > 0`. Omit or null for a free trial (the default).
166
+ #
167
+ # @return [Integer, nil]
168
+ optional :trial_amount, Integer, nil?: true
169
+
170
+ # @!attribute trial_apply_discounts
171
+ # Whether discount codes reduce the trial charge. Defaults to false. Only
172
+ # meaningful when a paid trial is configured.
173
+ #
174
+ # @return [Boolean, nil]
175
+ optional :trial_apply_discounts, Dodopayments::Internal::Type::Boolean, nil?: true
176
+
163
177
  # @!attribute trial_period_days
164
178
  # Number of days for the trial period. A value of `0` indicates no trial period.
165
179
  #
166
180
  # @return [Integer, nil]
167
181
  optional :trial_period_days, Integer
168
182
 
169
- # @!method initialize(currency:, discount:, payment_frequency_count:, payment_frequency_interval:, price:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, tax_inclusive: nil, trial_period_days: nil, type: :recurring_price)
183
+ # @!method initialize(currency:, discount:, payment_frequency_count:, payment_frequency_interval:, price:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, tax_inclusive: nil, trial_amount: nil, trial_apply_discounts: nil, trial_period_days: nil, type: :recurring_price)
170
184
  # Some parameter documentations has been truncated, see
171
185
  # {Dodopayments::Models::Price::RecurringPrice} for more details.
172
186
  #
@@ -190,6 +204,10 @@ module Dodopayments
190
204
  #
191
205
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
192
206
  #
207
+ # @param trial_amount [Integer, nil] Amount charged today for a paid trial, in the price currency's minor units.
208
+ #
209
+ # @param trial_apply_discounts [Boolean, nil] Whether discount codes reduce the trial charge. Defaults to false. Only meaningf
210
+ #
193
211
  # @param trial_period_days [Integer] Number of days for the trial period. A value of `0` indicates no trial period.
194
212
  #
195
213
  # @param type [Symbol, :recurring_price]
@@ -235,7 +235,15 @@ module Dodopayments
235
235
  # @return [String, nil]
236
236
  optional :tax_id, String, nil?: true
237
237
 
238
- # @!method initialize(addons:, billing:, brand_id:, cancel_at_next_billing_date:, created_at:, credit_entitlement_cart:, currency:, customer:, metadata:, meter_credit_entitlement_cart:, meters:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancellation_comment: nil, cancellation_feedback: nil, cancelled_at: nil, custom_field_responses: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, discounts: nil, expires_at: nil, payment_method_id: nil, scheduled_change: nil, tax_id: nil)
238
+ # @!attribute trial_amount
239
+ # Per-unit trial amount after discounts, snapshotted at subscription creation
240
+ # (price currency minor units, pre-quantity, pre-tax). Null for a free trial or no
241
+ # trial.
242
+ #
243
+ # @return [Integer, nil]
244
+ optional :trial_amount, Integer, nil?: true
245
+
246
+ # @!method initialize(addons:, billing:, brand_id:, cancel_at_next_billing_date:, created_at:, credit_entitlement_cart:, currency:, customer:, metadata:, meter_credit_entitlement_cart:, meters:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancellation_comment: nil, cancellation_feedback: nil, cancelled_at: nil, custom_field_responses: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, discounts: nil, expires_at: nil, payment_method_id: nil, scheduled_change: nil, tax_id: nil, trial_amount: nil)
239
247
  # Some parameter documentations has been truncated, see
240
248
  # {Dodopayments::Models::Subscription} for more details.
241
249
  #
@@ -314,6 +322,8 @@ module Dodopayments
314
322
  # @param scheduled_change [Dodopayments::Models::ScheduledPlanChange, nil] Scheduled plan change details, if any
315
323
  #
316
324
  # @param tax_id [String, nil] Tax identifier provided for this subscription (if applicable)
325
+ #
326
+ # @param trial_amount [Integer, nil] Per-unit trial amount after discounts, snapshotted at subscription creation
317
327
  end
318
328
  end
319
329
  end
@@ -83,7 +83,14 @@ module Dodopayments
83
83
  # @return [String, nil]
84
84
  optional :payment_link, String, nil?: true
85
85
 
86
- # @!method initialize(addons:, customer:, metadata:, payment_id:, recurring_pre_tax_amount:, subscription_id:, client_secret: nil, discount_id: nil, discount_ids: nil, expires_on: nil, one_time_product_cart: nil, payment_link: nil)
86
+ # @!attribute trial_amount
87
+ # Per-unit trial amount after discounts, in the price currency's minor units
88
+ # (pre-quantity, pre-tax). Null for a free trial or no trial.
89
+ #
90
+ # @return [Integer, nil]
91
+ optional :trial_amount, Integer, nil?: true
92
+
93
+ # @!method initialize(addons:, customer:, metadata:, payment_id:, recurring_pre_tax_amount:, subscription_id:, client_secret: nil, discount_id: nil, discount_ids: nil, expires_on: nil, one_time_product_cart: nil, payment_link: nil, trial_amount: nil)
87
94
  # Some parameter documentations has been truncated, see
88
95
  # {Dodopayments::Models::SubscriptionCreateResponse} for more details.
89
96
  #
@@ -110,6 +117,8 @@ module Dodopayments
110
117
  # @param one_time_product_cart [Array<Dodopayments::Models::SubscriptionCreateResponse::OneTimeProductCart>, nil] One time products associated with the purchase of subscription
111
118
  #
112
119
  # @param payment_link [String, nil] URL to checkout page
120
+ #
121
+ # @param trial_amount [Integer, nil] Per-unit trial amount after discounts, in the price currency's minor units
113
122
 
114
123
  class OneTimeProductCart < Dodopayments::Internal::Type::BaseModel
115
124
  # @!attribute product_id