dodopayments 2.20.1 → 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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/models/checkout_session_preview_response.rb +30 -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 +145 -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_response.rb +11 -1
  18. data/lib/dodopayments/resources/credit_entitlements/balances.rb +1 -1
  19. data/lib/dodopayments/resources/discounts.rb +24 -5
  20. data/lib/dodopayments/resources/payments.rb +3 -1
  21. data/lib/dodopayments/version.rb +1 -1
  22. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +33 -5
  23. data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rbi +6 -2
  24. data/rbi/dodopayments/models/discount.rbi +151 -2
  25. data/rbi/dodopayments/models/discount_create_params.rbi +197 -2
  26. data/rbi/dodopayments/models/discount_list_params.rbi +6 -2
  27. data/rbi/dodopayments/models/discount_type.rbi +1 -0
  28. data/rbi/dodopayments/models/discount_update_params.rbi +193 -2
  29. data/rbi/dodopayments/models/payment.rbi +347 -0
  30. data/rbi/dodopayments/models/payment_list_params.rbi +327 -0
  31. data/rbi/dodopayments/models/payment_method_types.rbi +0 -1
  32. data/rbi/dodopayments/models/price.rbi +20 -0
  33. data/rbi/dodopayments/models/subscription.rbi +15 -3
  34. data/rbi/dodopayments/models/subscription_create_response.rbi +13 -3
  35. data/rbi/dodopayments/models/subscription_list_response.rbi +15 -3
  36. data/rbi/dodopayments/resources/credit_entitlements/balances.rbi +3 -1
  37. data/rbi/dodopayments/resources/discounts.rbi +57 -3
  38. data/rbi/dodopayments/resources/payments.rbi +3 -0
  39. data/sig/dodopayments/models/checkout_session_preview_response.rbs +13 -3
  40. data/sig/dodopayments/models/discount.rbs +69 -0
  41. data/sig/dodopayments/models/discount_create_params.rbs +69 -0
  42. data/sig/dodopayments/models/discount_type.rbs +2 -1
  43. data/sig/dodopayments/models/discount_update_params.rbs +69 -0
  44. data/sig/dodopayments/models/payment.rbs +135 -0
  45. data/sig/dodopayments/models/payment_list_params.rbs +308 -0
  46. data/sig/dodopayments/models/payment_method_types.rbs +0 -2
  47. data/sig/dodopayments/models/price.rbs +10 -0
  48. data/sig/dodopayments/models/subscription.rbs +8 -3
  49. data/sig/dodopayments/models/subscription_create_response.rbs +8 -3
  50. data/sig/dodopayments/models/subscription_list_response.rbs +8 -3
  51. data/sig/dodopayments/resources/discounts.rbs +8 -0
  52. data/sig/dodopayments/resources/payments.rbs +1 -0
  53. metadata +2 -2
@@ -189,6 +189,16 @@ module Dodopayments
189
189
  # @return [String, nil]
190
190
  optional :error_message, String, nil?: true
191
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
+
192
202
  # @!attribute invoice_id
193
203
  # Invoice ID for this payment. Uses India-specific invoice ID if available.
194
204
  #
@@ -273,7 +283,7 @@ module Dodopayments
273
283
  # @return [Time, nil]
274
284
  optional :updated_at, Time, nil?: true
275
285
 
276
- # @!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, 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)
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)
277
287
  # Some parameter documentations has been truncated, see
278
288
  # {Dodopayments::Models::Payment} for more details.
279
289
  #
@@ -333,6 +343,8 @@ module Dodopayments
333
343
  #
334
344
  # @param error_message [String, nil] An error message if the payment failed
335
345
  #
346
+ # @param failure_details [Dodopayments::Models::Payment::FailureDetails, nil] Purpose-built failure messaging for the merchant and the customer, derived
347
+ #
336
348
  # @param invoice_id [String, nil] Invoice ID for this payment. Uses India-specific invoice ID if available.
337
349
  #
338
350
  # @param invoice_url [String, nil] URL to download the invoice PDF for this payment.
@@ -374,6 +386,138 @@ module Dodopayments
374
386
  # @return [Array<Symbol>]
375
387
  end
376
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
+
377
521
  class ProductCart < Dodopayments::Internal::Type::BaseModel
378
522
  # @!attribute product_id
379
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
@@ -182,7 +182,15 @@ module Dodopayments
182
182
  # @return [String, nil]
183
183
  optional :tax_id, String, nil?: true
184
184
 
185
- # @!method initialize(billing:, cancel_at_next_billing_date:, created_at:, currency:, customer:, discounts:, metadata:, 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:, cancelled_at: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, payment_method_id: nil, product_name: nil, scheduled_change: nil, tax_id: nil)
185
+ # @!attribute trial_amount
186
+ # Per-unit trial amount after discounts, snapshotted at subscription creation
187
+ # (price currency minor units, pre-quantity, pre-tax). Null for a free trial or no
188
+ # trial.
189
+ #
190
+ # @return [Integer, nil]
191
+ optional :trial_amount, Integer, nil?: true
192
+
193
+ # @!method initialize(billing:, cancel_at_next_billing_date:, created_at:, currency:, customer:, discounts:, metadata:, 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:, cancelled_at: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, payment_method_id: nil, product_name: nil, scheduled_change: nil, tax_id: nil, trial_amount: nil)
186
194
  # Some parameter documentations has been truncated, see
187
195
  # {Dodopayments::Models::SubscriptionListResponse} for more details.
188
196
  #
@@ -245,6 +253,8 @@ module Dodopayments
245
253
  # @param scheduled_change [Dodopayments::Models::ScheduledPlanChange, nil] Scheduled plan change details, if any
246
254
  #
247
255
  # @param tax_id [String, nil] Tax identifier provided for this subscription (if applicable)
256
+ #
257
+ # @param trial_amount [Integer, nil] Per-unit trial amount after discounts, snapshotted at subscription creation
248
258
 
249
259
  class Discount < Dodopayments::Internal::Type::BaseModel
250
260
  # @!attribute discount_id
@@ -136,7 +136,7 @@ module Dodopayments
136
136
  #
137
137
  # @param credit_entitlement_id [String] Path param: Credit Entitlement ID
138
138
  #
139
- # @param amount [String] Body param: Amount to credit or debit
139
+ # @param amount [String] Body param: Amount to credit or debit. Bounded to a `NUMERIC(38,28)` column, so
140
140
  #
141
141
  # @param entry_type [Symbol, Dodopayments::Models::CreditEntitlements::LedgerEntryType] Body param: Entry type: credit or debit
142
142
  #
@@ -9,24 +9,32 @@ module Dodopayments
9
9
  # POST /discounts If `code` is omitted or empty, a random 16-char uppercase code
10
10
  # is generated.
11
11
  #
12
- # @overload create(amount:, type:, code: nil, expires_at: nil, metadata: nil, name: nil, preserve_on_plan_change: nil, restricted_to: nil, subscription_cycles: nil, usage_limit: nil, request_options: {})
12
+ # @overload create(amount:, type:, 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, usage_limit: nil, request_options: {})
13
13
  #
14
14
  # @param amount [Integer] The discount amount in **basis points** (e.g. `540` means `5.4%`, `10000` means
15
15
  #
16
- # @param type [Symbol, Dodopayments::Models::DiscountType] The discount type. Currently only `percentage` is supported.
16
+ # @param type [Symbol, Dodopayments::Models::DiscountType] The discount type: `percentage` or `flat` (`flat_per_unit` stays blocked).
17
17
  #
18
18
  # @param code [String, nil] Optionally supply a code (will be uppercased).
19
19
  #
20
+ # @param currency_options [Array<Dodopayments::Models::DiscountCreateParams::CurrencyOption>, nil] Per-currency options (flat deduction / percentage cap + minimum subtotal).
21
+ #
22
+ # @param customer_eligibility [Symbol, Dodopayments::Models::DiscountCreateParams::CustomerEligibility, nil] Who may redeem this discount code. Defaults to `any` (unrestricted).
23
+ #
20
24
  # @param expires_at [Time, nil] When the discount expires, if ever.
21
25
  #
22
26
  # @param metadata [Hash{Symbol=>String, Float, Boolean}] Additional metadata for the discount
23
27
  #
24
28
  # @param name [String, nil]
25
29
  #
30
+ # @param per_customer_usage_limit [Integer, nil] Maximum number of times a single customer may redeem this discount.
31
+ #
26
32
  # @param preserve_on_plan_change [Boolean] Whether this discount should be preserved when a subscription changes plans.
27
33
  #
28
34
  # @param restricted_to [Array<String>, nil] List of product IDs to restrict usage (if any).
29
35
  #
36
+ # @param starts_at [Time, nil] When the discount becomes active, if scheduled for the future.
37
+ #
30
38
  # @param subscription_cycles [Integer, nil] Number of subscription billing cycles this discount is valid for.
31
39
  #
32
40
  # @param usage_limit [Integer, nil] How many times this discount can be used (if any).
@@ -72,7 +80,7 @@ module Dodopayments
72
80
  #
73
81
  # PATCH /discounts/{discount_id}
74
82
  #
75
- # @overload update(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: {})
83
+ # @overload update(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: {})
76
84
  #
77
85
  # @param discount_id [String] Discount Id
78
86
  #
@@ -80,19 +88,27 @@ module Dodopayments
80
88
  #
81
89
  # @param code [String, nil] If present, update the discount code (uppercase).
82
90
  #
91
+ # @param currency_options [Array<Dodopayments::Models::DiscountUpdateParams::CurrencyOption>, nil] If present, fully replaces the discount's currency options (replace-set
92
+ #
93
+ # @param customer_eligibility [Symbol, Dodopayments::Models::DiscountUpdateParams::CustomerEligibility, nil] If present, update who may redeem this discount. Plain field (not
94
+ #
83
95
  # @param expires_at [Time, nil]
84
96
  #
85
97
  # @param metadata [Hash{Symbol=>String, Float, Boolean}, nil] Additional metadata for the discount
86
98
  #
87
99
  # @param name [String, nil]
88
100
  #
101
+ # @param per_customer_usage_limit [Integer, nil] If present, update the per-customer usage limit (double-option: send
102
+ #
89
103
  # @param preserve_on_plan_change [Boolean, nil] Whether this discount should be preserved when a subscription changes plans.
90
104
  #
91
105
  # @param restricted_to [Array<String>, nil] If present, replaces all restricted product IDs with this new set.
92
106
  #
107
+ # @param starts_at [Time, nil] If present, update `starts_at` (double-option: send `null` to clear it).
108
+ #
93
109
  # @param subscription_cycles [Integer, nil] Number of subscription billing cycles this discount is valid for.
94
110
  #
95
- # @param type [Symbol, Dodopayments::Models::DiscountType, nil] If present, update the discount type. Currently only `percentage` is supported.
111
+ # @param type [Symbol, Dodopayments::Models::DiscountType, nil] If present, update the discount type (`percentage` or `flat`).
96
112
  #
97
113
  # @param usage_limit [Integer, nil]
98
114
  #
@@ -112,11 +128,14 @@ module Dodopayments
112
128
  )
113
129
  end
114
130
 
131
+ # Some parameter documentations has been truncated, see
132
+ # {Dodopayments::Models::DiscountListParams} for more details.
133
+ #
115
134
  # GET /discounts
116
135
  #
117
136
  # @overload list(active: nil, code: nil, discount_type: nil, page_number: nil, page_size: nil, product_id: nil, request_options: {})
118
137
  #
119
- # @param active [Boolean] Filter by active status (true = not expired, false = expired)
138
+ # @param active [Boolean] Filter by active status. `true` = currently redeemable (started, not
120
139
  #
121
140
  # @param code [String] Filter by discount code (partial match, case-insensitive)
122
141
  #
@@ -82,7 +82,7 @@ module Dodopayments
82
82
  )
83
83
  end
84
84
 
85
- # @overload list(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: {})
85
+ # @overload list(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: {})
86
86
  #
87
87
  # @param brand_id [String] filter by Brand id
88
88
  #
@@ -90,6 +90,8 @@ module Dodopayments
90
90
  #
91
91
  # @param created_at_lte [Time] Get events created before this time
92
92
  #
93
+ # @param currency [Symbol, Dodopayments::Models::PaymentListParams::Currency] Filter by currency
94
+ #
93
95
  # @param customer_id [String] Filter by customer id
94
96
  #
95
97
  # @param page_number [Integer] Page number default is 0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "2.20.1"
4
+ VERSION = "2.21.0"
5
5
  end