dodopayments 2.33.0 → 2.34.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/internal/type/enum.rb +11 -11
  5. data/lib/dodopayments/models/charge_type.rb +33 -0
  6. data/lib/dodopayments/models/checkout_session_preview_response.rb +12 -1
  7. data/lib/dodopayments/models/invoices/payment_retrieve_params.rb +14 -1
  8. data/lib/dodopayments/models/invoices/payment_retrieve_payout_params.rb +14 -1
  9. data/lib/dodopayments/models/invoices/payment_retrieve_refund_params.rb +14 -1
  10. data/lib/dodopayments/models/payment.rb +57 -8
  11. data/lib/dodopayments/models/payment_list_response.rb +63 -6
  12. data/lib/dodopayments/models/price.rb +56 -20
  13. data/lib/dodopayments/models/product_collections/group_update_params.rb +2 -1
  14. data/lib/dodopayments/models/subscription_service_period.rb +12 -1
  15. data/lib/dodopayments/models.rb +2 -0
  16. data/lib/dodopayments/resources/invoices/payments.rb +30 -6
  17. data/lib/dodopayments/version.rb +1 -1
  18. data/lib/dodopayments.rb +1 -0
  19. data/rbi/dodopayments/models/charge_type.rbi +37 -0
  20. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +14 -0
  21. data/rbi/dodopayments/models/invoices/payment_retrieve_params.rbi +17 -1
  22. data/rbi/dodopayments/models/invoices/payment_retrieve_payout_params.rbi +21 -2
  23. data/rbi/dodopayments/models/invoices/payment_retrieve_refund_params.rbi +21 -2
  24. data/rbi/dodopayments/models/payment.rbi +70 -8
  25. data/rbi/dodopayments/models/payment_list_response.rbi +76 -6
  26. data/rbi/dodopayments/models/price.rbi +96 -24
  27. data/rbi/dodopayments/models/product_collections/group_update_params.rbi +4 -2
  28. data/rbi/dodopayments/models/subscription_service_period.rbi +24 -4
  29. data/rbi/dodopayments/models.rbi +2 -0
  30. data/rbi/dodopayments/resources/invoices/payments.rbi +12 -0
  31. data/rbi/dodopayments/resources/product_collections/groups.rbi +2 -1
  32. data/sig/dodopayments/models/charge_type.rbs +16 -0
  33. data/sig/dodopayments/models/checkout_session_preview_response.rbs +5 -0
  34. data/sig/dodopayments/models/invoices/payment_retrieve_params.rbs +7 -1
  35. data/sig/dodopayments/models/invoices/payment_retrieve_payout_params.rbs +8 -1
  36. data/sig/dodopayments/models/invoices/payment_retrieve_refund_params.rbs +8 -1
  37. data/sig/dodopayments/models/payment.rbs +20 -0
  38. data/sig/dodopayments/models/payment_list_response.rbs +25 -0
  39. data/sig/dodopayments/models/subscription_service_period.rbs +10 -1
  40. data/sig/dodopayments/models.rbs +2 -0
  41. data/sig/dodopayments/resources/invoices/payments.rbs +3 -0
  42. metadata +5 -2
@@ -34,6 +34,12 @@ module Dodopayments
34
34
  sig { returns(T::Boolean) }
35
35
  attr_accessor :has_license_key
36
36
 
37
+ # True when this payment also bills metered usage or credit overage. The usage is
38
+ # for the billing cycle before the service period, not for the service period. The
39
+ # value is set for each payment status. It is false when `charge_type` is null.
40
+ sig { returns(T::Boolean) }
41
+ attr_accessor :includes_usage
42
+
37
43
  # True when one payment starts more than one subscription. Read this field to find
38
44
  # the payment type. Do not read the length of `subscription_ids`. Do not read
39
45
  # `subscription_id` for null.
@@ -66,7 +72,10 @@ module Dodopayments
66
72
  # the same as `subscription_ids`. For a plan change charge, the period starts at
67
73
  # the plan change and ends at the next billing date. The list is empty unless the
68
74
  # payment status is `succeeded`. The list is also empty for a one-time payment, an
69
- # on-demand charge, or a payment method update.
75
+ # on-demand charge, or a payment method update. The list is set for `new`,
76
+ # `renewal` and `plan_change` charges that succeeded. It can be empty for some
77
+ # zero-amount payments. A `renewal` with no entry for its subscription bills usage
78
+ # only. That payment does not extend the service period.
70
79
  sig { returns(T::Array[Dodopayments::SubscriptionServicePeriod]) }
71
80
  attr_accessor :service_periods
72
81
 
@@ -79,14 +88,38 @@ module Dodopayments
79
88
  sig { returns(Integer) }
80
89
  attr_accessor :total_amount
81
90
 
91
+ # Expiry month of the card, as two digits from `01` to `12`. For Apple Pay and
92
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
93
+ # expiry of the physical card.
94
+ sig { returns(T.nilable(String)) }
95
+ attr_accessor :card_exp_month
96
+
97
+ # Expiry year of the card, as four digits, for example `2029`. For Apple Pay and
98
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
99
+ # expiry of the physical card.
100
+ sig { returns(T.nilable(String)) }
101
+ attr_accessor :card_exp_year
102
+
82
103
  # The last four digits of the card
83
104
  sig { returns(T.nilable(String)) }
84
105
  attr_accessor :card_last_four
85
106
 
86
- # Card network like VISA, MASTERCARD etc.
107
+ # Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older
108
+ # payments can carry other casing.
87
109
  sig { returns(T.nilable(String)) }
88
110
  attr_accessor :card_network
89
111
 
112
+ # The type of card, in lowercase: `credit`, `debit` or `prepaid`. Older payments
113
+ # can carry other casing.
114
+ sig { returns(T.nilable(String)) }
115
+ attr_accessor :card_type
116
+
117
+ # The type of subscription charge that this payment is for. Refer to `ChargeType`.
118
+ # The value is set for each payment status, not only for `succeeded`. The value is
119
+ # null when this payment charges no subscription.
120
+ sig { returns(T.nilable(Dodopayments::ChargeType::TaggedSymbol)) }
121
+ attr_accessor :charge_type
122
+
90
123
  # The ID of the checkout session for this payment. The value is null when the
91
124
  # payment does not use a checkout session.
92
125
  sig { returns(T.nilable(String)) }
@@ -100,7 +133,9 @@ module Dodopayments
100
133
  sig { returns(T.nilable(String)) }
101
134
  attr_accessor :invoice_id
102
135
 
103
- # URL to download the invoice PDF for this payment.
136
+ # DEPRECATED: Use `GET /invoices/payments/{payment_id}` with an API key. URL to
137
+ # download the invoice PDF for this payment. The URL has no signed token. If the
138
+ # business asks for a credential on its invoice links, the URL needs an API key.
104
139
  sig { returns(T.nilable(String)) }
105
140
  attr_accessor :invoice_url
106
141
 
@@ -131,6 +166,7 @@ module Dodopayments
131
166
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
132
167
  digital_products_delivered: T::Boolean,
133
168
  has_license_key: T::Boolean,
169
+ includes_usage: T::Boolean,
134
170
  is_multi_subscription: T::Boolean,
135
171
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
136
172
  payment_id: String,
@@ -141,8 +177,12 @@ module Dodopayments
141
177
  T::Array[Dodopayments::SubscriptionServicePeriod::OrHash],
142
178
  subscription_ids: T::Array[String],
143
179
  total_amount: Integer,
180
+ card_exp_month: T.nilable(String),
181
+ card_exp_year: T.nilable(String),
144
182
  card_last_four: T.nilable(String),
145
183
  card_network: T.nilable(String),
184
+ card_type: T.nilable(String),
185
+ charge_type: T.nilable(Dodopayments::ChargeType::OrSymbol),
146
186
  checkout_session_id: T.nilable(String),
147
187
  dispute_status: T.nilable(Dodopayments::DisputeStatus::OrSymbol),
148
188
  invoice_id: T.nilable(String),
@@ -161,6 +201,10 @@ module Dodopayments
161
201
  customer:,
162
202
  digital_products_delivered:,
163
203
  has_license_key:,
204
+ # True when this payment also bills metered usage or credit overage. The usage is
205
+ # for the billing cycle before the service period, not for the service period. The
206
+ # value is set for each payment status. It is false when `charge_type` is null.
207
+ includes_usage:,
164
208
  # True when one payment starts more than one subscription. Read this field to find
165
209
  # the payment type. Do not read the length of `subscription_ids`. Do not read
166
210
  # `subscription_id` for null.
@@ -179,17 +223,36 @@ module Dodopayments
179
223
  # the same as `subscription_ids`. For a plan change charge, the period starts at
180
224
  # the plan change and ends at the next billing date. The list is empty unless the
181
225
  # payment status is `succeeded`. The list is also empty for a one-time payment, an
182
- # on-demand charge, or a payment method update.
226
+ # on-demand charge, or a payment method update. The list is set for `new`,
227
+ # `renewal` and `plan_change` charges that succeeded. It can be empty for some
228
+ # zero-amount payments. A `renewal` with no entry for its subscription bills usage
229
+ # only. That payment does not extend the service period.
183
230
  service_periods:,
184
231
  # Every subscription that this payment starts or charges, in a stable order. It is
185
232
  # empty for a one-time payment. It holds the value of `subscription_id` when the
186
233
  # payment names one subscription.
187
234
  subscription_ids:,
188
235
  total_amount:,
236
+ # Expiry month of the card, as two digits from `01` to `12`. For Apple Pay and
237
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
238
+ # expiry of the physical card.
239
+ card_exp_month: nil,
240
+ # Expiry year of the card, as four digits, for example `2029`. For Apple Pay and
241
+ # Google Pay, this is the expiry of the wallet token, which can differ from the
242
+ # expiry of the physical card.
243
+ card_exp_year: nil,
189
244
  # The last four digits of the card
190
245
  card_last_four: nil,
191
- # Card network like VISA, MASTERCARD etc.
246
+ # Card network, in lowercase, for example `visa`, `mastercard` or `amex`. Older
247
+ # payments can carry other casing.
192
248
  card_network: nil,
249
+ # The type of card, in lowercase: `credit`, `debit` or `prepaid`. Older payments
250
+ # can carry other casing.
251
+ card_type: nil,
252
+ # The type of subscription charge that this payment is for. Refer to `ChargeType`.
253
+ # The value is set for each payment status, not only for `succeeded`. The value is
254
+ # null when this payment charges no subscription.
255
+ charge_type: nil,
193
256
  # The ID of the checkout session for this payment. The value is null when the
194
257
  # payment does not use a checkout session.
195
258
  checkout_session_id: nil,
@@ -197,7 +260,9 @@ module Dodopayments
197
260
  dispute_status: nil,
198
261
  # Invoice ID for this payment. Uses India-specific invoice ID if available.
199
262
  invoice_id: nil,
200
- # URL to download the invoice PDF for this payment.
263
+ # DEPRECATED: Use `GET /invoices/payments/{payment_id}` with an API key. URL to
264
+ # download the invoice PDF for this payment. The URL has no signed token. If the
265
+ # business asks for a credential on its invoice links, the URL needs an API key.
201
266
  invoice_url: nil,
202
267
  payment_method: nil,
203
268
  payment_method_type: nil,
@@ -218,6 +283,7 @@ module Dodopayments
218
283
  customer: Dodopayments::CustomerLimitedDetails,
219
284
  digital_products_delivered: T::Boolean,
220
285
  has_license_key: T::Boolean,
286
+ includes_usage: T::Boolean,
221
287
  is_multi_subscription: T::Boolean,
222
288
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
223
289
  payment_id: String,
@@ -227,8 +293,12 @@ module Dodopayments
227
293
  service_periods: T::Array[Dodopayments::SubscriptionServicePeriod],
228
294
  subscription_ids: T::Array[String],
229
295
  total_amount: Integer,
296
+ card_exp_month: T.nilable(String),
297
+ card_exp_year: T.nilable(String),
230
298
  card_last_four: T.nilable(String),
231
299
  card_network: T.nilable(String),
300
+ card_type: T.nilable(String),
301
+ charge_type: T.nilable(Dodopayments::ChargeType::TaggedSymbol),
232
302
  checkout_session_id: T.nilable(String),
233
303
  dispute_status:
234
304
  T.nilable(Dodopayments::DisputeStatus::TaggedSymbol),
@@ -167,12 +167,14 @@ module Dodopayments
167
167
  sig { returns(Dodopayments::Currency::OrSymbol) }
168
168
  attr_accessor :currency
169
169
 
170
- # Number of units for the payment frequency. For example, a value of `1` with a
171
- # `payment_frequency_interval` of `month` represents monthly payments.
170
+ # Number of `payment_frequency_interval` units between two charges. This field
171
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
172
+ # `month` charges the customer every month.
172
173
  sig { returns(Integer) }
173
174
  attr_accessor :payment_frequency_count
174
175
 
175
- # The time interval for the payment frequency (e.g., day, month, year).
176
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
177
+ # `payment_frequency_count`.
176
178
  sig { returns(Dodopayments::TimeInterval::OrSymbol) }
177
179
  attr_accessor :payment_frequency_interval
178
180
 
@@ -181,12 +183,28 @@ module Dodopayments
181
183
  sig { returns(Integer) }
182
184
  attr_accessor :price
183
185
 
184
- # Number of units for the subscription period. For example, a value of `12` with a
185
- # `subscription_period_interval` of `month` represents a one-year subscription.
186
+ # Number of `subscription_period_interval` units for the total duration of the
187
+ # subscription. This field does not set the billing cycle. Use
188
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
189
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
190
+ # subscription expires. Dodo Payments can still retry a failed payment for an
191
+ # earlier billing cycle.
192
+ #
193
+ # For a subscription that renews until the customer cancels it, set this to `20`
194
+ # with a `subscription_period_interval` of `year`. This is the recommended value
195
+ # and also the maximum. The subscription expires after 20 years if the customer
196
+ # does not cancel it before then.
197
+ #
198
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
199
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
200
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
201
+ # the subscription then expires after one month.
186
202
  sig { returns(Integer) }
187
203
  attr_accessor :subscription_period_count
188
204
 
189
- # The time interval for the subscription period (e.g., day, month, year).
205
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
206
+ # it with `subscription_period_count`. The recommended value is `year`, with a
207
+ # `subscription_period_count` of `20`.
190
208
  sig { returns(Dodopayments::TimeInterval::OrSymbol) }
191
209
  attr_accessor :subscription_period_interval
192
210
 
@@ -280,18 +298,36 @@ module Dodopayments
280
298
  def self.new(
281
299
  # The currency in which the payment is made.
282
300
  currency:,
283
- # Number of units for the payment frequency. For example, a value of `1` with a
284
- # `payment_frequency_interval` of `month` represents monthly payments.
301
+ # Number of `payment_frequency_interval` units between two charges. This field
302
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
303
+ # `month` charges the customer every month.
285
304
  payment_frequency_count:,
286
- # The time interval for the payment frequency (e.g., day, month, year).
305
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
306
+ # `payment_frequency_count`.
287
307
  payment_frequency_interval:,
288
308
  # The payment amount. Represented in the lowest denomination of the currency
289
309
  # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
290
310
  price:,
291
- # Number of units for the subscription period. For example, a value of `12` with a
292
- # `subscription_period_interval` of `month` represents a one-year subscription.
311
+ # Number of `subscription_period_interval` units for the total duration of the
312
+ # subscription. This field does not set the billing cycle. Use
313
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
314
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
315
+ # subscription expires. Dodo Payments can still retry a failed payment for an
316
+ # earlier billing cycle.
317
+ #
318
+ # For a subscription that renews until the customer cancels it, set this to `20`
319
+ # with a `subscription_period_interval` of `year`. This is the recommended value
320
+ # and also the maximum. The subscription expires after 20 years if the customer
321
+ # does not cancel it before then.
322
+ #
323
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
324
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
325
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
326
+ # the subscription then expires after one month.
293
327
  subscription_period_count:,
294
- # The time interval for the subscription period (e.g., day, month, year).
328
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
329
+ # it with `subscription_period_count`. The recommended value is `year`, with a
330
+ # `subscription_period_count` of `20`.
295
331
  subscription_period_interval:,
296
332
  # Deprecated: use `discount_bps` instead.
297
333
  #
@@ -372,21 +408,39 @@ module Dodopayments
372
408
  sig { returns(Integer) }
373
409
  attr_accessor :fixed_price
374
410
 
375
- # Number of units for the payment frequency. For example, a value of `1` with a
376
- # `payment_frequency_interval` of `month` represents monthly payments.
411
+ # Number of `payment_frequency_interval` units between two charges. This field
412
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
413
+ # `month` charges the customer every month.
377
414
  sig { returns(Integer) }
378
415
  attr_accessor :payment_frequency_count
379
416
 
380
- # The time interval for the payment frequency (e.g., day, month, year).
417
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
418
+ # `payment_frequency_count`.
381
419
  sig { returns(Dodopayments::TimeInterval::OrSymbol) }
382
420
  attr_accessor :payment_frequency_interval
383
421
 
384
- # Number of units for the subscription period. For example, a value of `12` with a
385
- # `subscription_period_interval` of `month` represents a one-year subscription.
422
+ # Number of `subscription_period_interval` units for the total duration of the
423
+ # subscription. This field does not set the billing cycle. Use
424
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
425
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
426
+ # subscription expires. Dodo Payments can still retry a failed payment for an
427
+ # earlier billing cycle.
428
+ #
429
+ # For a subscription that renews until the customer cancels it, set this to `20`
430
+ # with a `subscription_period_interval` of `year`. This is the recommended value
431
+ # and also the maximum. The subscription expires after 20 years if the customer
432
+ # does not cancel it before then.
433
+ #
434
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
435
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
436
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
437
+ # the subscription then expires after one month.
386
438
  sig { returns(Integer) }
387
439
  attr_accessor :subscription_period_count
388
440
 
389
- # The time interval for the subscription period (e.g., day, month, year).
441
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
442
+ # it with `subscription_period_count`. The recommended value is `year`, with a
443
+ # `subscription_period_count` of `20`.
390
444
  sig { returns(Dodopayments::TimeInterval::OrSymbol) }
391
445
  attr_accessor :subscription_period_interval
392
446
 
@@ -451,15 +505,33 @@ module Dodopayments
451
505
  # The fixed payment amount. Represented in the lowest denomination of the currency
452
506
  # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
453
507
  fixed_price:,
454
- # Number of units for the payment frequency. For example, a value of `1` with a
455
- # `payment_frequency_interval` of `month` represents monthly payments.
508
+ # Number of `payment_frequency_interval` units between two charges. This field
509
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
510
+ # `month` charges the customer every month.
456
511
  payment_frequency_count:,
457
- # The time interval for the payment frequency (e.g., day, month, year).
512
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
513
+ # `payment_frequency_count`.
458
514
  payment_frequency_interval:,
459
- # Number of units for the subscription period. For example, a value of `12` with a
460
- # `subscription_period_interval` of `month` represents a one-year subscription.
515
+ # Number of `subscription_period_interval` units for the total duration of the
516
+ # subscription. This field does not set the billing cycle. Use
517
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
518
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
519
+ # subscription expires. Dodo Payments can still retry a failed payment for an
520
+ # earlier billing cycle.
521
+ #
522
+ # For a subscription that renews until the customer cancels it, set this to `20`
523
+ # with a `subscription_period_interval` of `year`. This is the recommended value
524
+ # and also the maximum. The subscription expires after 20 years if the customer
525
+ # does not cancel it before then.
526
+ #
527
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
528
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
529
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
530
+ # the subscription then expires after one month.
461
531
  subscription_period_count:,
462
- # The time interval for the subscription period (e.g., day, month, year).
532
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
533
+ # it with `subscription_period_count`. The recommended value is `year`, with a
534
+ # `subscription_period_count` of `20`.
463
535
  subscription_period_interval:,
464
536
  # Deprecated: use `discount_bps` instead.
465
537
  #
@@ -22,7 +22,8 @@ module Dodopayments
22
22
  attr_accessor :group_id
23
23
 
24
24
  # Optional group name update: Some(Some(name)) = set name, Some(None) = clear
25
- # name, None = no change
25
+ # name, None = no change The API returns 422 if another group in the collection
26
+ # has no name.
26
27
  sig { returns(T.nilable(String)) }
27
28
  attr_accessor :group_name
28
29
 
@@ -49,7 +50,8 @@ module Dodopayments
49
50
  id:,
50
51
  group_id:,
51
52
  # Optional group name update: Some(Some(name)) = set name, Some(None) = clear
52
- # name, None = no change
53
+ # name, None = no change The API returns 422 if another group in the collection
54
+ # has no name.
53
55
  group_name: nil,
54
56
  # Optional new order for products in this group (array of
55
57
  # product_collection_group_pdts UUIDs)
@@ -15,6 +15,13 @@ module Dodopayments
15
15
  sig { returns(Time) }
16
16
  attr_accessor :ends_at
17
17
 
18
+ # The part of one full billing period that the plan charge pays for. The value
19
+ # `"1"` is a full period. A value less than 1 is a partial period, for example
20
+ # after a plan change that keeps the billing cycle. For a plan change, this is the
21
+ # value of the new plan. The credit for the old plan is not in this value.
22
+ sig { returns(String) }
23
+ attr_accessor :proration_factor
24
+
18
25
  # Start of the service period. For a renewal, this is the billing date. For a plan
19
26
  # change that applies at the next billing date, this is the time when the change
20
27
  # applied. This time can be some minutes after the billing date.
@@ -27,13 +34,21 @@ module Dodopayments
27
34
 
28
35
  # The service period that a payment pays for, for one subscription.
29
36
  sig do
30
- params(ends_at: Time, starts_at: Time, subscription_id: String).returns(
31
- T.attached_class
32
- )
37
+ params(
38
+ ends_at: Time,
39
+ proration_factor: String,
40
+ starts_at: Time,
41
+ subscription_id: String
42
+ ).returns(T.attached_class)
33
43
  end
34
44
  def self.new(
35
45
  # End of the service period.
36
46
  ends_at:,
47
+ # The part of one full billing period that the plan charge pays for. The value
48
+ # `"1"` is a full period. A value less than 1 is a partial period, for example
49
+ # after a plan change that keeps the billing cycle. For a plan change, this is the
50
+ # value of the new plan. The credit for the old plan is not in this value.
51
+ proration_factor:,
37
52
  # Start of the service period. For a renewal, this is the billing date. For a plan
38
53
  # change that applies at the next billing date, this is the time when the change
39
54
  # applied. This time can be some minutes after the billing date.
@@ -45,7 +60,12 @@ module Dodopayments
45
60
 
46
61
  sig do
47
62
  override.returns(
48
- { ends_at: Time, starts_at: Time, subscription_id: String }
63
+ {
64
+ ends_at: Time,
65
+ proration_factor: String,
66
+ starts_at: Time,
67
+ subscription_id: String
68
+ }
49
69
  )
50
70
  end
51
71
  def to_hash
@@ -60,6 +60,8 @@ module Dodopayments
60
60
 
61
61
  CbbProrationBehavior = Dodopayments::Models::CbbProrationBehavior
62
62
 
63
+ ChargeType = Dodopayments::Models::ChargeType
64
+
63
65
  CheckoutSessionBillingAddress =
64
66
  Dodopayments::Models::CheckoutSessionBillingAddress
65
67
 
@@ -7,12 +7,16 @@ module Dodopayments
7
7
  sig do
8
8
  params(
9
9
  payment_id: String,
10
+ token: String,
10
11
  request_options: Dodopayments::RequestOptions::OrHash
11
12
  ).returns(StringIO)
12
13
  end
13
14
  def retrieve(
14
15
  # Payment ID
15
16
  payment_id,
17
+ # The signed link token. If the business asks for a credential on its invoice
18
+ # links, a valid token for this record replaces the credential.
19
+ token: nil,
16
20
  request_options: {}
17
21
  )
18
22
  end
@@ -20,12 +24,16 @@ module Dodopayments
20
24
  sig do
21
25
  params(
22
26
  payout_id: String,
27
+ token: String,
23
28
  request_options: Dodopayments::RequestOptions::OrHash
24
29
  ).returns(StringIO)
25
30
  end
26
31
  def retrieve_payout(
27
32
  # Payout ID
28
33
  payout_id,
34
+ # The signed link token. If the business asks for a credential on its invoice
35
+ # links, a valid token for this record replaces the credential.
36
+ token: nil,
29
37
  request_options: {}
30
38
  )
31
39
  end
@@ -33,12 +41,16 @@ module Dodopayments
33
41
  sig do
34
42
  params(
35
43
  refund_id: String,
44
+ token: String,
36
45
  request_options: Dodopayments::RequestOptions::OrHash
37
46
  ).returns(StringIO)
38
47
  end
39
48
  def retrieve_refund(
40
49
  # Refund ID
41
50
  refund_id,
51
+ # The signed link token. If the business asks for a credential on its invoice
52
+ # links, a valid token for this record replaces the credential.
53
+ token: nil,
42
54
  request_options: {}
43
55
  )
44
56
  end
@@ -51,7 +51,8 @@ module Dodopayments
51
51
  # Path param: Product Collection Id
52
52
  id:,
53
53
  # Body param: Optional group name update: Some(Some(name)) = set name, Some(None)
54
- # = clear name, None = no change
54
+ # = clear name, None = no change The API returns 422 if another group in the
55
+ # collection has no name.
55
56
  group_name: nil,
56
57
  # Body param: Optional new order for products in this group (array of
57
58
  # product_collection_group_pdts UUIDs)
@@ -0,0 +1,16 @@
1
+ module Dodopayments
2
+ module Models
3
+ type charge_type = :new | :renewal | :plan_change | :on_demand
4
+
5
+ module ChargeType
6
+ extend Dodopayments::Internal::Type::Enum
7
+
8
+ NEW: :new
9
+ RENEWAL: :renewal
10
+ PLAN_CHANGE: :plan_change
11
+ ON_DEMAND: :on_demand
12
+
13
+ def self?.values: -> ::Array[Dodopayments::Models::charge_type]
14
+ end
15
+ end
16
+ end
@@ -142,6 +142,7 @@ module Dodopayments
142
142
  description: String?,
143
143
  discount_amount: Integer?,
144
144
  discount_cycle: Integer?,
145
+ monthly_equivalent: Integer?,
145
146
  name: String?,
146
147
  tax: Integer?
147
148
  }
@@ -181,6 +182,8 @@ module Dodopayments
181
182
 
182
183
  attr_accessor discount_cycle: Integer?
183
184
 
185
+ attr_accessor monthly_equivalent: Integer?
186
+
184
187
  attr_accessor name: String?
185
188
 
186
189
  attr_accessor tax: Integer?
@@ -203,6 +206,7 @@ module Dodopayments
203
206
  ?description: String?,
204
207
  ?discount_amount: Integer?,
205
208
  ?discount_cycle: Integer?,
209
+ ?monthly_equivalent: Integer?,
206
210
  ?name: String?,
207
211
  ?tax: Integer?
208
212
  ) -> void
@@ -225,6 +229,7 @@ module Dodopayments
225
229
  description: String?,
226
230
  discount_amount: Integer?,
227
231
  discount_cycle: Integer?,
232
+ monthly_equivalent: Integer?,
228
233
  name: String?,
229
234
  tax: Integer?
230
235
  }
@@ -2,7 +2,7 @@ module Dodopayments
2
2
  module Models
3
3
  module Invoices
4
4
  type payment_retrieve_params =
5
- { payment_id: String }
5
+ { payment_id: String, token: String }
6
6
  & Dodopayments::Internal::Type::request_parameters
7
7
 
8
8
  class PaymentRetrieveParams < Dodopayments::Internal::Type::BaseModel
@@ -11,13 +11,19 @@ module Dodopayments
11
11
 
12
12
  attr_accessor payment_id: String
13
13
 
14
+ attr_reader token: String?
15
+
16
+ def token=: (String) -> String
17
+
14
18
  def initialize: (
15
19
  payment_id: String,
20
+ ?token: String,
16
21
  ?request_options: Dodopayments::request_opts
17
22
  ) -> void
18
23
 
19
24
  def to_hash: -> {
20
25
  payment_id: String,
26
+ token: String,
21
27
  request_options: Dodopayments::RequestOptions
22
28
  }
23
29
  end
@@ -2,7 +2,8 @@ module Dodopayments
2
2
  module Models
3
3
  module Invoices
4
4
  type payment_retrieve_payout_params =
5
- { payout_id: String } & Dodopayments::Internal::Type::request_parameters
5
+ { payout_id: String, token: String }
6
+ & Dodopayments::Internal::Type::request_parameters
6
7
 
7
8
  class PaymentRetrievePayoutParams < Dodopayments::Internal::Type::BaseModel
8
9
  extend Dodopayments::Internal::Type::RequestParameters::Converter
@@ -10,13 +11,19 @@ module Dodopayments
10
11
 
11
12
  attr_accessor payout_id: String
12
13
 
14
+ attr_reader token: String?
15
+
16
+ def token=: (String) -> String
17
+
13
18
  def initialize: (
14
19
  payout_id: String,
20
+ ?token: String,
15
21
  ?request_options: Dodopayments::request_opts
16
22
  ) -> void
17
23
 
18
24
  def to_hash: -> {
19
25
  payout_id: String,
26
+ token: String,
20
27
  request_options: Dodopayments::RequestOptions
21
28
  }
22
29
  end
@@ -2,7 +2,8 @@ module Dodopayments
2
2
  module Models
3
3
  module Invoices
4
4
  type payment_retrieve_refund_params =
5
- { refund_id: String } & Dodopayments::Internal::Type::request_parameters
5
+ { refund_id: String, token: String }
6
+ & Dodopayments::Internal::Type::request_parameters
6
7
 
7
8
  class PaymentRetrieveRefundParams < Dodopayments::Internal::Type::BaseModel
8
9
  extend Dodopayments::Internal::Type::RequestParameters::Converter
@@ -10,13 +11,19 @@ module Dodopayments
10
11
 
11
12
  attr_accessor refund_id: String
12
13
 
14
+ attr_reader token: String?
15
+
16
+ def token=: (String) -> String
17
+
13
18
  def initialize: (
14
19
  refund_id: String,
20
+ ?token: String,
15
21
  ?request_options: Dodopayments::request_opts
16
22
  ) -> void
17
23
 
18
24
  def to_hash: -> {
19
25
  refund_id: String,
26
+ token: String,
20
27
  request_options: Dodopayments::RequestOptions
21
28
  }
22
29
  end